Y
Y
Yaroslav2021-12-25 12:26:04
Algorithms
Yaroslav, 2021-12-25 12:26:04

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

1 answer(s)
A
Alexandroppolus, 2021-12-25
@Alexandroppolus

https://en.wikipedia.org/wiki/Ternary_search_tree
has a deletion there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question