Jump to content

Red black tree sort/Wren: Difference between revisions

m
Fixed some typos.
m (Removed an unused line.)
m (Fixed some typos.)
Line 4:
<lang ecmascript>import "random" for Random
 
/* Represents a node in the red -black tree. */
class Node {
// constructs a new node
Line 31:
}
 
/* Represents a red -black tree data structure. */
class RBTree {
// constructs a new red -black truetree specifying whether duplicate keys are allowed or not
construct new(allowDups) {
_tnull = Node.new()
Line 278:
 
// find the node with the maximum key
maximunmaximum(node) {
while (node.right != _tnull) node = node.right
return node
9,490

edits

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