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?

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.