Data Structures · Assignment · Problem 3

Problem 3: Insertion into a Binary Search Tree — insert 15 / 90 / 65

Initial BST: 52 (30(20,40), 75(60,80)) · insert 15 / 90 / 65 with InsertBST(value)

🌳 The initial binary search tree

node already in the initial tree comparing value with node newly inserted node (pops in) rule: value < node → left, otherwise right; insert at the empty spot

💬 Current step

💻 Lecture C++ code (whole program)

Yellow = the pseudocode line being executed (the assignment Algorithm: InsertBST). The panel on the right records every comparison until an empty spot is reached.

🧭 Comparison walk from the root down to the empty spot

Speed
Shortcuts: Space play/pause · ←→ step · R reset · E result