Fundamentals of Data Structures - Notes Flashcards

1
Q

Abstract data types

A

They make use of other data structures to form a new way of storing data

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

Advantage of using adjancency list

A

Memory Efficient as only stores the edges that exist in the graph

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

Disadvantage of adjancency list

A

Time ineffiecient as slow to query, as each item in a list must be searched sequentially until the desired edge is found

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

Disadvantage of using adjancency matrix

A

Memory ineffiecient as stores every possible edge between nodes, even those that dont exist and half of the graph is repeated

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

Advantage of using adjancency matrix

A

Time effiecient as allows a specific edge to be queried very quickly, as it can be looked up by its row and column

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

What is a dictionary

A

A collection of key value pairs in which the values is accessed by its associated key.

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

How do dynamic data strucutres work

A

Each item of data is stored in the structure alongside a reference to where the next item is stored in memory. If the number of data items exceeds the number of memory locations allocated to the strucutre, new memory locations are simply added to the structure until there is enough space for the data.

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

Describe the steps of rehashing

A

A larger hash table is created
Each value in the existing table is inserted into the new table
In a position determined by a new hashing algorithm

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

Explain how a value is stored in a hash table

A

Hashing algorithm applied to the key
The result is an index of where to store the value in an array
It is possible that the hashing algorithm might generate the same key for two different values which is called a collision

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

Why is hashing used

A

So that searching, adding and deleting can be done efficiently

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