Binary Trees: C++ Trees

Binary Trees:

  • Binary Trees are trees with the utmost two children.
  • Strict/proper binary trees: Binary Trees in which each node can have either zero or two children.
  • Complete Binary Tree: All levels except the last are completely filled, and all nodes are as left as possible, as shown in the image.Image result for complete binary trees
  • Perfect binary tree: a Binary tree with all the levels filled.
  • Max number of nodes in a binary tree with height(longest path from a leaf to the root node) h is: $2^z-1$ Where $Z= h + 1$ or Z is also the number of levels in the tree.
  • Balanced Binary Tree: A binary tree is balanced if the difference between the height of left and right subtree is less than equal to 1.
  • Recall the definition of height of a tree, that being said, a single node tree has a height of zero. A zero node tree has a height of -1.

Implementing Binary trees:

  • Using Dynamically created Linked nodes.
  • Using Arrays.

No comments:

Post a Comment

Installing albert on ubuntu 19.04

Installing Albert on Ubuntu 19.04... Albert is not still released for ubuntu 19.04. But still, you can install it using the following ...