Cheat sheets

DS-09Cheat sheet1 pageIn a paid pack

Binary Tree Properties

Binary tree terminology with the height convention made explicit, the node, leaf, edge and NULL-link relations, maximum and minimum nodes for a height, full, complete and perfect trees with their counts, full k-ary trees, and the array representation with its worst-case waste. Every relation is checked by brute force over all tree shapes with up to 9 nodes.

Diagrams from DS-09

DS-10Cheat sheet1 pageIn a paid pack

Tree Traversals and Reconstruction

Preorder, inorder, postorder and level-order traversal with their time and space costs, iterative inorder with a stack, rebuilding a binary tree from preorder or postorder plus inorder with two worked traces, which traversal pairs fix a unique tree and how many trees share an ambiguous pair, positional facts about first and last nodes, and threaded binary trees. Uniqueness claims are checked by brute force.

Diagrams from DS-10

DS-11Cheat sheet1 pageIn a paid pack

Expression Trees and Counting Trees

Expression trees and how preorder, inorder and postorder give prefix, infix and postfix, building one from a postfix string, Catalan counts of binary tree shapes, labelled trees and binary search trees (also with a fixed root), chains and full trees, the left-child right-sibling form of general trees, and recursive tree functions in compiled C. Counts are brute-forced over all shapes and permutations.

Diagrams from DS-11