Tutoring Section 6: Tree Traversals, Stacks and Queues

Tree Traversals, Stacks and Queues

Stacks and Queues are data structures in which it matters when you add a specific it to the specific fringe for obtaining this item later. A stack works according to a ‘last in first out’ framework where newer items will be popped off before the items that were pushed on the stack earlier. A queue, on the other side, is a data structures where the first item that came in will be the first one to be dequeued, literally like a queue. These data structures despite their simplicity play a fundamental role in tree traversals as they are used as a fringe for DFS and BFS, respectively.


Walkthrough videos

Note: The tutoring worksheets are property of CS61B(L) and are solely intended for the purpose of personal use.