1.4.2 Data Structures

studied byStudied by 2 people
0.0(0)
Get a hint
Hint

Arrays

1 / 17

flashcard set

Earn XP

18 Terms

1

Arrays

An ordered, static set of elements of a single type. A 1D array is a linear array. Unless stated in the question, arrays are always taken to be zero-indexed

New cards
2

2D and 3D arrays

2D: Can be visualised as a table or spreadsheet. When searching through, you first go down the rows and then across the columns.

3D: Can be visualised as a multi-page spreadsheet. Selecting an element requires three variables. An array number, the row number an the column number

New cards
3

Records

More commonly referred to as a row in a file and is made up of fields. Used in databases. Each field in a records can be identified by recordName.fieldName. When creating a record, a variable must first be declared before its attributes can be accessed

New cards
4

Lists

A data structure consisting of a number of ordered items where the items can occur more than once. Can contain elements of more than one data type

New cards
5

Tuples

An immutable, ordered set of values of any type. Once it is created it cannot be changed. Tuples are initialised using regular brackets instead of square brackets

New cards
6

Linked Lists

A dynamic data structure used to hold an ordered sequence where the items forming it are stored non-contiguously. Each item is called a node, and contains a data field alongside another address called a link or pointer field which contains the address of the next item in the list

New cards
7

Manipulating a linked list

Values can easily be added or removed by editing pointers. When removing a node, it isn’t actually deleted, only ignored. Although this is easier, it wastes memory and as items are stored in a sequence, they can only be traversed in this order and cannot be accessed directly

New cards
8

Graphs

A set of vertices/nodes connected by edges/arcs. There are three types:

  • Directed: Edges can only be traversed in one direction

  • Undirected: Edges can be traversed in both directions

  • Weighted: A cost is attached to each edge

New cards
9

Stacks

A last in first out data structure. Items can only be added to or removed from the top of the stack. Used to reverse an action, such as go back a page in web browsers. Stacks can be implemented as either a static or dynamic structure

New cards
10

Queues

A first in first out data structure. Items are added to the end of the queue and are removed from the front of the queue

New cards
11

Linear queue

Items are added into the next available space in the queue, starting from the front. Makes user of two pointers, one at the front and one at the back

New cards
12

Circular queue

Once the queue’s rear pointer is equal to the maximum size of the queue it can loop back to the front, using space more effectively

New cards
13

Trees

A connected form of a graph. Trees have a root node which is the top node. Nodes are connected using branches, with the lower-level nodes being the children of the higher-level nodes

New cards
14

Binary tree

A type of tree in which each node has a maximum of two children

New cards
15

Pre-Order Traversal

Follows the order: root node, left subtree, right subtree. Using the outline method, nodes are traversed in the order in which you pass them on the left, beginning at the left hand side

New cards
16

In-Order Traversal

Follows the order: left subtree, root node, right subtree. Using the outline method, nodes are traversed in order in which you pass under them

New cards
17

Post-Order Traversal

Follows the order: left subtree, right subtree, root node. Using the outline method, nodes are traversed in the order in which you pass them on the right

New cards
18

Hash Tables

An array which is coupled with a hash function. The hash function takes in data (a key) and releases an output (the hash) and maps the key to an index in the hash table

New cards

Explore top notes

note Note
studied byStudied by 4 people
... ago
5.0(1)
note Note
studied byStudied by 127 people
... ago
5.0(2)
note Note
studied byStudied by 4 people
... ago
5.0(1)
note Note
studied byStudied by 10 people
... ago
5.0(1)
note Note
studied byStudied by 31 people
... ago
5.0(2)
note Note
studied byStudied by 19 people
... ago
5.0(2)
note Note
studied byStudied by 302 people
... ago
5.0(1)
note Note
studied byStudied by 5838 people
... ago
4.9(26)

Explore top flashcards

flashcards Flashcard (25)
studied byStudied by 10 people
... ago
5.0(1)
flashcards Flashcard (47)
studied byStudied by 22 people
... ago
5.0(1)
flashcards Flashcard (41)
studied byStudied by 1 person
... ago
5.0(1)
flashcards Flashcard (74)
studied byStudied by 143 people
... ago
5.0(1)
flashcards Flashcard (53)
studied byStudied by 165 people
... ago
5.0(1)
flashcards Flashcard (24)
studied byStudied by 5 people
... ago
5.0(1)
flashcards Flashcard (39)
studied byStudied by 8 people
... ago
5.0(1)
flashcards Flashcard (117)
studied byStudied by 3 people
... ago
5.0(1)
robot