0

It is to my understanding when inserting a node to a binary search tree, the data element of the new node is compared to the data element of the node that will be the parent.

Now that I have a Ternary Search Tree with two data elements and three keys I am confused as to how I perform the insert. Please correct me if I am wrong. If both key1 and key2 of a Ternary Node are less than the key1 of the parent node, then I know I my node becomes a left child. If both key1 and key2 are greater than key1 of the parent node, but less than the key2 of the parent node, then my node becomes a middle child. And if both key1 and key2 are greater than key2 of the parent node, then my node becomes a right child.

My question is, what happens when key1 and key2 of my new node does not meet the previous conditions? For example what if key1 of the new node is less than key1 of the parent, and key2 of the new node is greater than key1 of the parent node, how will the insertion() be performed?

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by naz arif
0

can you b more clear with your question??....like give an example of what you want to do....

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.