summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRaito Bezarius2024-03-25 21:09:26 +0100
committerRaito Bezarius2024-03-25 21:09:26 +0100
commit014fc51d291188afd405c33a8281fbb5013ad304 (patch)
tree23df157fac378d94aa98d2605770ed0f328522f5 /src
parentd6dce7238ad59f67b6b9bad1b3e50984bb69e84e (diff)
Initial extraction
Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/main.rs16
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);
-}