Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
streambot committed Sep 21, 2010
1 parent b04d4ff commit 6489bdc
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Search/Treap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,20 @@ public int GetMaxX()
return n.x;
}

public static Treap Find(Treap node, int searchX)
{
if (node != null)
{
if (node.x == searchX)
return node;
if (searchX < node.x)
return Find(node.Left, searchX);
if (searchX > node.x)
return Find(node.Right, searchX);
}
return null;
}

public void ForEachInOrder(NodeValueAction action)
{
if (Left != null)
Expand Down

0 comments on commit 6489bdc

Please sign in to comment.