Data Structures/Algorithms Flashcards

1
Q

What are the essential data structures and when should they be used?

A

Stack - LIFO structure, useful for remembering state without need for indices
Queue - FIFO structure,
Array - linked items with index access, faster for index retrieval and iteration.
LinkedList - linked items no index access, faster for insert/deleteand dynamic in size.
Trees - non linear relationship between data with nodes
Hashset - unordered unique value set, useful forv determining membership.
Dictionary - key value pairs, fast retrieval and enforces unique key

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

What are the associated algorithms with each structure and when should they be used?

A

Array - Linear search in worse case scenario, binary search when data is sorted
Stack - Pop, Push, Peek
Queue - Enqueue, Dequeue, Peek
LinkedList - Head, add/delete node
Trees - Preorder, Inorder, Postorder Traversal, Binary search
Hashset - add
Dictionary - add

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