Jump to content

Red black tree sort: Difference between revisions

m
red black deletion is intricate and it should be implemented and tested.
mNo edit summary
m (red black deletion is intricate and it should be implemented and tested.)
Line 4:
 
Start with an empty tree, add 30 nodes each with arbitrary (aka "random") keys, then traverse the tree, printing the values from the left node, the key value, then the values from the right node, displaying their value and their color. Since we are using a red-black tree here, this would eliminate any duplicate values.
 
Then delete an arbitrary 15 nodes and display the resulting tree.
 
You may use an implementation at [[Algebraic data types]] as a starting point, if you find that helpful.
6,962

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.