Notes

Search

Search IconIcon to open search

Trees

Last updated Dec 25, 2022

A tree consists of

In a rooted tree, we call one node priviledged node the root.

In a rooted binary tree, every node has either 0, 1, or 2 children (subtrees).

A binary search tree is a rooted binary tree with one additional property: the BST property.

BST property: For every node X in the tree:

Note that there is a difference between a Binary Tree, and a binary search tree. A binary tree is a tree where every node has at most two children. A binary search tree is a binary tree where the BST property holds.

Ordering must be complete, transitive, and antisymmetric. Given keys p and q:

One consequence of these rules : No duplicate keys are allowed in a BST.