Data Structures/Algorithms Flashcards
What are the essential data structures and when should they be used?
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
What are the associated algorithms with each structure and when should they be used?
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