[Week 7] Binary Trees

Summary

Today we covered the basics of binary trees.

Important terms

  • Graph: a data structure made out of nodes and edges
    • you can think of the edges like roads
    • the edges could have a direct (like one way streets)
  • Node: In a graph, this is like a variable, it represents a piece of information
    • you can also think of it as cities
  • Edge: In a graph, edges connect two nodes
    • you can also think of edges as roads
  • Tree: a data structure with the following properties:
    • there are no cycles (you can’t follow edges in a cirlce)
    • there is a root node (the top most part of the tree)
    • edges are called branches
    • each node can have children
    • the node with children is the children’s parent
  • Root node: the topmost part of the tree
  • Binary Trees: Each node can have at most 2 children
  • Leaves: A leaf is the nodes in a tree with no children
  • Binary Search Trees: each parent is larger than its left child and smaller than its right

Extra Resources

Lecture Slides