Class 15 - Alwynblake/seattle-javascript-401n12 GitHub Wiki

Trees

  • Binary Tree: Binary Trees are trees that only contain no more than 2 children. There is not a specific sorting order for a binary tree. Nodes can be added into a binary tree wherever space allows.

  • Search Tree: A binary search tree is a type of tree that does have structure attached to it. In a binary search tree, the tree is organized in a manner where all values that are smaller than the root are placed to the left, and all values that are larger than the root are placed to the right.

  1. Node - a node is the individual item/data that make up the data structure.
  2. Root - The root is the first/top Node in a tree
  3. Left Child - The node that is positioned to the left of the root
  4. Right Child - The node that is positioned to the right of the root
  5. Edge - The edge in a tree is the link between two nodes
  6. Leaf - A leaf is the node that does not contain either a left child or a right child node.
  7. Height - The height of a tree is determined by the number of edges from the root to the bottommost node.