implement 'exists' function on bro-tree as well, and benchmark it compared to string-set
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user