Skip to content

Instantly share code, notes, and snippets.

@jordanlewis
Created May 2, 2012 05:12
Show Gist options
  • Save jordanlewis/2573976 to your computer and use it in GitHub Desktop.
Save jordanlewis/2573976 to your computer and use it in GitHub Desktop.
PFDS Unbalanced Tree Set implementation
class UnbalancedTreeSet[T] private (tree: BinaryTree[T]) (implicit val ordering: Ordering[T])
extends Set[T] {
def this()(implicit ordering : Ordering[T]) = this(BinaryTreeLeaf)(ordering)
private def newSet(tree: BinaryTree[T]) = new UnbalancedTreeSet[T](tree);
def insert(x: T) = newSet(UnbalancedTreeSet.insert(x, tree))
def member(x: T) = UnbalancedTreeSet.member(x, tree)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment