Red black tree sort/Wren: Difference between revisions

Content deleted Content added
PureFox (talk | contribs)
Improved approach to check for duplicates - see talk page.
PureFox (talk | contribs)
Fixed syntax highlighting.
Line 2:
 
Although red black trees don't necessarily need to disallow duplicate keys, I've adjusted the code to optionally disallow them. Not that it matters here as the method of constructing the random keys ensures that there will be no duplicates in any case.
<langsyntaxhighlight lang="ecmascript">import "random" for Random
 
/* Represents a node in the red-black tree. */
Line 425:
System.print(deletions)
System.print()
bst.prettyPrint()</langsyntaxhighlight>
 
{{out}}