Data Structures Flashcards

to learn

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

What are the common data structures?

A

Queues
Lists
Stack,
Arrays
Hash Tables
Graphs
Trees
Binary Search Trees

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

What is an abstract data type?

A

Logical representation of the data and enforced behaviour where the user does not know how the data structure is actually implemented.

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

Operations of a queue

A

Enqueue
Dequeue
IsFull
IsEmpty
Peek

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

Operations of a stack

A

Push
Pop
IsFull
IsEmpty
Peek

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

What is the difference between static and dynamic data structures?

A

Static data structure - fixed size
Dynamic data structure - grows and shrinks to match its contents

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

Definition of a queue

A

-Abstract data structure
-First thing to be added to queue is first out (FIFO)
-Front and rear pointer

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

Types of queue

A

Linear
Circular
Priority

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

Describe a linear queue

A

-Has front and rear pointer
-Queue can run out of space as front pointer reaches end of available addresses
-Follows First In First Out (FIFO) approach

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

Describe a circular queue

A

Front and rear pointer can point at index zero when it reaches end of available address
More memory efficient because it can reuse a previously used space

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

Describe a priority queue

A

Item given priority
Item with highest priority dequeued before the items with lower priority
2 items with same priority follow First In First Out (FIFO)

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

Definition of a stack

A

-Abstract data structure
-First item to be pushed is last to be popped (First In Last Out)
-Top Pointer (Bottom is always index 0, so no need for bottom pointer)

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

Definition of a hash table

A

Used to change data with a one way transformation with a mathematical process (different to encryption as it cannot be reversed)
If two inputs hash to the same index, collision occurs and skip value is added on to destination index to get a new index (repeat process again)
Modulus operator is used if you reach the last index to go to the starting index
Skip value is set as part of table
Hash table ideally 2/3 full because reduces odds of collisions without being too memory inefficient

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

Explain the process of resizing a hash table

A

Take the number of items in hash table and multiply by 1.5
Create new hash table of that size and traverse old hash table, rehashing each item

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

Definition of a tree

A

A connected, undirected graph with no cycles

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

Definition of a binary tree

A

A rooted tree in which each node has at most 2 children

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

Definition of rooted tree

A

A tree in which one node has been designated as the root

17
Q

Definition of directed graph

A

A graph where the order of the vertices paired in an edge matter (one way)

18
Q

Definition of undirected graph

A

A graph where the order of the vertices paired in an edge does not matter. (bidirectional)

19
Q

What is an Adjacency Matrix

A

A matrix representation of a graph that stores the edges connecting all possible nodes.

20
Q

Definition of a weighted graph

A

A graph where each edge has an associated value

21
Q
A