implement 'exists' function on bro-tree as well, and benchmark it compared to string-set

This commit is contained in:
2024-09-09 15:57:58 +01:00
parent fc0fd6923b
commit b7a365c6b8
7 changed files with 95 additions and 0 deletions

View File

@@ -54,4 +54,14 @@ struct
fun insert (str, tree) =
insRoot (ins (str, tree))
fun exists (str, tree) =
case tree of
N0 => false
| N1 t => exists (str, t)
| N2 (l, k, r) =>
if str < k then exists (str, l)
else if str > k then exists (str, r)
else true
| _ => raise Match
end