done with insert into search list

This commit is contained in:
2024-11-12 03:15:04 +00:00
parent 8bf0b64ef3
commit 1bae34a067
2 changed files with 11 additions and 0 deletions

View File

@@ -130,4 +130,15 @@ struct
{left = left, right = right}
end
| [] => {left = left, right = right}
fun insert (new, {left, right}: t) =
(* look at elements to see which way to traverse *)
case right of
hd :: _ =>
if Vector.sub (hd, 0) >= new then
insRight (new, left, right)
else
insLeft (new, left, right)
| [] =>
insLeft (new, left, right)
end

BIN
shf

Binary file not shown.