Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
working on rbst
  • Loading branch information
timm committed Jan 8, 2012
1 parent a0fc6bf commit 863e8ca
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions build/lib/rbst.coffee
Expand Up @@ -96,18 +96,23 @@ class RandomBinaryTree
h.n = x.n = null
h.right = x.left
x.left = h
h.size(); x.size()
h.reset(); x.reset();
h.size() ; x.size()
x
rotateR: (h) ->
x = h.left
h.left = x.right
x.right = h
h.size(); x.size()
h.reset(); x.reset();
h.size() ; x.size()
x
reset:() ->
@n = null
size:() ->
@n = 1
@n += @left.size() if @left
@n += @right.size() if @right
unless @n
@n = 1
@n += @left.size() if @left
@n += @right.size() if @right
@n

# Inserting an Item
Expand Down

0 comments on commit 863e8ca

Please sign in to comment.