Created
May 2, 2012 05:12
-
-
Save jordanlewis/2573976 to your computer and use it in GitHub Desktop.
PFDS Unbalanced Tree Set implementation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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