🧠

Tree

  • First node -->- root
  • Node with no children --> leaf

Binary Tree

  • Each node can have at most two child nodes
  • Unique path exists from root to every other node
    • Every node (except the root) has a single parent

Binary Search Tree

  • Same shape as a binary tree
  • Value of any node is greater than value of any node in its left subtree
  • Value of any node is less than value of any node in its right subtree
  • Can recursively search for a node similar to binary search

Searching

Depth-first search vs breadth-first search

Computer Science Data Structure