CS 271: Trees Module: Introduction To Binary TreesModule content developed by Professor Tralie. Module engine developed by Professor Tralie and Professor Mongan.
Below is a video from CS 174. The first 7 minutes go over the concept of binary trees, and the rest shows how to implement them in C++. Do take a moment to review the C++ implementation; we will talk about some C++ code for trees in class, because they will give us a great opportunity to practice recursion and memory management in synergy.
- A binary tree is a generalization where every node has both a
rightreference to other nodes, known as the left and right child nodes, respectively.
- Binary trees are drawn from top to bottom by convention. The top node where a binary tree starts is called the
- If a node
cis the child of a node
pis referred to as
- Binary trees are naturally recursive data structure, as an entire subtree can be spliced in by making the left child of a node be the root of that subtree.