Loading tutorials
Node class and the five-node tree from the previous chapter.2 min readNode class and the recursive height function from the earlier chapters. It also assumes you know basic Big-O notation. Two trees can hold the same keys and still behave very differently. The difference is their shape.2 min readNode class and tree vocabulary. Here we cover the shared idea behind the three depth-first traversals. The next three chapters cover each order in detail.2 min readNode class from the earlier chapter on representing binary trees.2 min readNode class from the earlier chapter on representing a binary tree. Inorder is the second of the three depth-first orders.2 min readNode class from earlier chapters, and understand basic Big-O notation. The examples reuse the five-node tree built earlier.3 min readNode class from earlier, how a queue works (first in, first out), and Big-O basics. Level-order traversal is also called breadth-first traversal. It visits every node at depth 0, then every node at depth 1, and so on, moving left to right within each level.2 min readNode class and root tree from earlier chapters.2 min readinorder traversal, and the Node class from earlier chapters. Keys are distinct.2 min readNode class (value, left, right). Here two traversals do real work: postorder evaluates an expression, and preorder saves a tree as text.2 min readNode class from earlier chapters. It also assumes you are comfortable with dictionaries and Big-O notation.2 min readNode class from earlier, level-order traversal, and basic Big-O. It shows how to store a binary tree in a plain list with no node objects and no pointers.2 min readleft and right, and Big-O basics.2 min read