Skip to main content
16 events
when toggle format what by license comment
Sep 28, 2016 at 22:30 history edited Raphael
edited tags
Sep 28, 2016 at 22:27 history edited Gilles 'SO- stop being evil'
edited tags
Sep 28, 2016 at 22:25 comment added Raphael Google "binary search tree".
Sep 28, 2016 at 22:24 history edited Raphael
edited tags
Sep 28, 2016 at 19:55 history edited Gilles 'SO- stop being evil'
edited tags
Sep 27, 2016 at 7:34 history migrated from stackoverflow.com (revisions)
Sep 27, 2016 at 7:33 vote accept CommunityBot
Sep 27, 2016 at 7:31 comment added RealSkeptic Red-black trees are a very well-known, classical technique. The definitive explanation on how they work, including adding, removing, balancing etc. is in the book Introduction To Algorithms by Cormen, Leiserson and Rivest (shortly referred to as CLR). If you want to understand the code, you should familiarize yourself with the technique, the "coloring" of the nodes etc. Most people here don't wish to re-introduce this well-known explanation, so you should go to the source (or try Wikipedia).
Sep 27, 2016 at 7:29 answer added Pulkit timeline score: 2
Sep 27, 2016 at 7:25 comment added Luud van Keulen @Spotted I have seen that source code and found the method that fixes the tree but I can't figure out what is going on. You can find the sourcecode here
Sep 27, 2016 at 7:22 comment added Spotted This is what happens internally.
Sep 27, 2016 at 7:20 comment added jonrsharpe According to the docs I just linked, it uses the algorithm from CLR; if you want more info, that's where to look.
Sep 27, 2016 at 7:19 comment added Luud van Keulen I want to know what happens in java. If it rebuilds it how does it do it? Put everything back in a list or just shuffle everything?
Sep 27, 2016 at 7:19 comment added Marko Topolnik Stack Overflow isn't the place to come to for answers from the textbook. If you ask specifically about java.util.TreeMap, read about Red-Black trees and study the source code.
Sep 27, 2016 at 7:17 comment added jonrsharpe Are you talking about the specific implementation in Java (TreeMap) or just in general? The short answer is you have to reattach all the disconnected nodes.
Sep 27, 2016 at 7:14 history asked Luud van Keulen CC BY-SA 3.0