Answer the question
In order to leave comments, you need to log in
What does deletion look like from a ternary tree?
The university set the task - to write a ternary search tree with insertion, traversal, search and deletion functions. From all this I do not understand how to implement the removal. I tried googling, like all the previous ones. I found it, but it doesn’t work, to put it mildly, because according to the algorithm, the vertex and all its descendants are deleted, and according to the condition of setting the descendants, they must be moved. But with the movement I have a problem, I do not understand the logic of this movement.
I tried to use this vertex's ancestors and great-ancestors, but it turns out in manual mode, which is not good.
But I don’t understand how to make both deletion and permutation with one algorithm.
Where can I read about it or how can it be implemented?
Answer the question
In order to leave comments, you need to log in
https://en.wikipedia.org/wiki/Ternary_search_tree
has a deletion there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question