Cheat sheets

DS-07Cheat sheet1 pageIn a paid pack

Linked Lists: Operations and Costs

Singly, doubly and circular linked lists and sentinel nodes: insertion and deletion with the pointer updates in a safe order, the cost of every common operation with and without a tail pointer, the copy-next deletion trick and where it fails, empty and one-node cases, and arrays compared with lists.

Diagrams from DS-07

DS-08Cheat sheet1 pageIn a paid pack

Linked List Algorithms

Compiled C for in-place reversal with three pointers, the middle node with slow and fast pointers (and which middle each loop condition returns), Floyd cycle detection with the cycle start and length, merging two sorted lists with comparison bounds, the k-th node from the end, and GATE CS 2010 Q.36 (moving the last node to the front), all with outputs produced by the compiler.

Diagrams from DS-08