Data Structures Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is a 1 dimensional array defined as?

A

a finite set of elements of the same data type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a tuple?

A

A set of values which can be of any data type, but can not be changed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What makes up a record?

A

several fields that each contain one item of data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is an abstract data type?

A

A data type that has been created by the programmer.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How does a queue work?

A

Data can only be added to the end and Data can only be retrieved from the front.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Give some common examples of abstract data types? (4 things)

A

Queues, stacks, graphs and lists

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a dynamic data structure?

A

A data structure that is able to increase or decrease the amount of space in memory it takes up.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the heap?

A

A portion of memory of which space is automatically allocated or de-allocated as required. This allows for dynamic data structures.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the main drawback of using dynamic data structures?

A

They can cause an overflow if they exceed the maximum memory limit which will cause data to be lost and the program to crash.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are examples of dynamic data structures? (2 things)

A

queues, stacks

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a static data structure?

A

A data structure that is fixed in size

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is an example of a static data structure?

A

array

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the difference between a priority queue and a normal queue

A

In a priority queue the items are removed from the queue based on their priority, with the item with the highest priority being removed first, rather than being removed in the order they were added to the queue.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a list?

A

An abstract data type made up of items, in which the same item may occur more than once.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does each node in a linked list contain?

A

The data field and a pointer field that points to the next item in the list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How does a stack work?

A

If you want to remove an item, you have to remove the item that was added most recently.

17
Q

How does a hash table work?

A

The data being stored is passed into a hashing algorithm that generates an address, the data is then stored at that address in the hash table.

18
Q

What is a graph?

A

A graph is a set of nodes connected by edges. An edge can have a weight to show the cost to traverse it and a direction in which it must be traversed.

19
Q

What is a depth first traversal of a graph?

A

You go as far down one route as you can before backtracking until you can take a new route.

20
Q

What is a breadth first traversal of a graph?

A

We visit all the neighbours of the root node, and then all the neighbours of the first node visited, and then all the neighbours of the second node and so on.

21
Q

What is a binary tree?

A

A graph where each node, apart from the root node, has one parent and a maximum of two children.

22
Q

What is a pre-order traversal of a binary tree?

A

Draw an outline around the tree starting with at the root node and moving left. Output the data in each node as you pass to the left of it.

23
Q

What is an in-order traversal of a binary tree?

A

Draw an outline around the tree starting with at the root node and moving left. Output the data in each node as you pass under it.

24
Q

What is a post-order traversal of a binary tree?

A

Draw an outline around the tree starting with at the root node and moving left. Output the data in each node as you pass to the right of it.