diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/main.rs b/src/main.rs index d5bb8f9..884b367 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,10 +1,14 @@ -use std::cmp::Ordering; +pub enum Ordering { + Less, + Equal, + Greater, +} trait Ord { fn cmp(&self, other: &Self) -> Ordering; } -struct AVLNode<T: Ord> { +struct AVLNode<T> { value: T, left: AVLTree<T>, right: AVLTree<T>, @@ -12,7 +16,7 @@ struct AVLNode<T: Ord> { type AVLTree<T> = Option<Box<AVLNode<T>>>; -struct AVLTreeSet<T: Ord> { +struct AVLTreeSet<T> { root: AVLTree<T>, } @@ -53,9 +57,3 @@ impl Ord for u32 { } } } - -fn main() { - let mut tree = AVLTreeSet::new(); - tree.insert(3); - tree.insert(2); -} |