Skip to content

Instantly share code, notes, and snippets.

@nrl240
Last active July 22, 2020 20:04
Show Gist options
  • Save nrl240/817df288515c6488502937d197619f70 to your computer and use it in GitHub Desktop.
Save nrl240/817df288515c6488502937d197619f70 to your computer and use it in GitHub Desktop.
Exit Ticket: Day 26 - Data Structures

Exit Ticket: Day 26 - Data Structures

Choose whether a given object is a Data Structure (DS) or an Abstract Data Type (ADT):

DS ADT Can be implemented using... Features include...
Contiguous Array ✔️ n/a Uninterrupted space in memory (RAM)
Stack ✔️ arrays, linked lists Linear, LIFO, top reference, push, pop, peek, isEmpty, size
Queue ✔️ arrays, linked lists Linear, FIFO, head/front and tail/back references, enqueue/add/enter, dequeue/remove/leave, peek, isEmpty, size
List ✔️ arrays, linked lists Linear, "flexible" arrays, get/find, insert/add, remove/delete, isEmpty, size
Tree ✔️ arrays, linked trees Non-linear, level, depth, height, root, leaf, parent, left-child, right-child, subtree, traversals (see final two exit ticket question below)
Linked List ✔️ n/a Placed wherever there is space in memory (RAM) and connected by references

Match the method with the appropriate ADT

Stack Queue
Enqueue ✔️
Dequeue ✔️
Push ✔️
Pop ✔️

Choose which type of tree traversal is better for the given task.

Breadth-First Search (BFS) Depth-First Search (DFS)
Traverses a tree level by level ✔️
Traverses a tree branch by branch ✔️
Good for copying a BST ✔️ (Specifically, pre-order)
Extra: Implemented using... Queue ADT Stack ADT / Recursive call stack

Match each use case with the appropriate depth first traversal methods.

Pre-order
(root, left, right)
Post-order
(left, right, root)
In-order
(left, root, right)
Produce a sorted list of items from a BST ✔️
Remove all tree nodes from memory ✔️
Clone a binary search tree ✔️
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment