Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- generic[K, C:Comparator[K]]
- struct Tree{
- ...
- }
- implementation Tree{
- generic[S]
- method find(Self self, S key): bool
- where Comparator[S].compare(K,S)
- {
- var node = self.root;
- while (node != null) {
- switch(self.c.compare(node.key, key)){
- case GT: node = node.right;
- case LT: node = node.left;
- case EQ: return true;
- }
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement