Initial project import

This commit is contained in:
Agila Forge Importer committed 2026-07-13 15:20:32 +00:00
commit 23f2d29e32
11957 files changed
+1754577

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
import datatypes
struct KeyVal {
mut:
key int
val int
}
fn (a KeyVal) == (b KeyVal) bool {
return a.key == b.key
}
fn (a KeyVal) < (b KeyVal) bool {
return a.key < b.key
}
fn main() {
mut bst := datatypes.BSTree[KeyVal]{}
bst.insert(KeyVal{ key: 1, val: 12 })
println(bst.in_order_traversal())
bst.insert(KeyVal{ key: 2, val: 34 })
bst.insert(KeyVal{ key: -2, val: 203 })
for elem in bst.in_order_traversal() {
println(elem.val)
}
}