PDA

View Full Version : Simple BST root insertion help



Extrovert
11-19-2003, 09:31 AM
Ok, this something which I can find on the web, but I'm kind of having trouble finding it. I'm learning about insertion in a binary search tree and rotation. This is where you have to rotate certain nodes in a tree to restore its shape after inserting a key into a tree.

Given 31,42,59,44, and 36, use root insertion to insert into an initially empty tree. How would this be done?

Given 50,34,56,78,98 (assuming this is traversing inorder), what would rootInsert(30) be?

Prelude
11-19-2003, 10:30 AM
Good timing. I just recently finished writing two tutorials on the subject of binary search trees and balancing. Take a look here (http://www.cppworld.com/tutorials.php). Though this one (http://www.cppworld.com/tutorials.php?id=20) is the one you want.