Trees (Abstract data type)

Table of Contents

Trees

  1. Collection of nodes
    1. One specialized node is the root.
    2. A node has one parent (unless it is the root)
    3. A node has zero or more children. Each node can have any number of children.
  2. Real-world “trees”:
    1. Organizational hierarchies
    2. Some family trees
  3. Some uses:
    1. Directory structure on a hard drive
    2. Sorted collections
Operations Provided Efficiency (only if the tree is balanced)
Find O(log n)
Add/remove O(log n)

Tags

  1. How to formulaically solve tree challenges?
  2. Binary Trees
  3. Binary Search Trees
  4. Height and Depth of Binary Tree
  5. Heap (data structure)

depth first searches breadth first searches