Slippery Rock University Dr. Deborah Whitfield Go Browns!

Chapter 8: Binary Trees
Data Structures and Algorithms in Java
CpSc 374

Topics
  1. Binary Tree Terminology
  2. Binary Tree Properties
  3. Binary Tree Efficiency
  4. Binary Tree Minimum Maximum
  5. Inserting a Node
  6. Traversals
  7. Delete a Node
  8. Finding Min
  9. Binary Search Tree

Tree Terminology


Top

Binary Search Tree Properties


Top

Find Efficiency


Top

Finding Min or Max


Top

Inserting a Node


Top

Binary Tree Traversals -- Fun stuff!!


Top

Delete a node

Delete a Node Case 1 Delete a Node Case 2 Delete a Node Case 3

Successor

  1. Find minimum in right subtree
    a. Step right
    b. While there is a left child
    --- Step left
  2. Delete a Node Case 3a
    Successor has no children
Example Tree vs. Subtree

Efficiency Revisited

Finding Min or Succesor


Top

BST Comparison


Top