Is it possible to update the node key in a red-black tree without deleting and pasting?

Typically, changes to a key in a red-black tree should be done by deleting and then reinserting the node.

Is it possible to update keys to node in a red ebony tree, which is more efficient than delete + insert?

+1
source share
1 answer

Implement an update using [search if required +] delete + insert

1 - delete the key O (log n)
2 - insert a new node with the new key O (log n)
Even if you are first looking for the key, this is O (log n).

For more on RBT, see this page .

+1
source

Source: https://habr.com/ru/post/1688354/


All Articles