a bit of bug fixing regarding implementation of dijstra's algorithm (next to fix: query towards quad/platform tree)

This commit is contained in:
2025-01-20 02:38:22 +00:00
parent 322a394138
commit 6783dac9e0
3 changed files with 33 additions and 49 deletions

View File

@@ -74,13 +74,17 @@ struct
| insert (x, ts) =
NODE (x, 0, []) :: ts
fun findMin [] = Elem.default
| findMin [t] = root t
| findMin (t :: ts) =
let val x = findMin ts
fun helpFindMin (prev, []) = root prev
| helpFindMin (prev, [t]) = root t
| helpFindMin (prev, t :: ts) =
let val x = helpFindMin (t, ts)
in if Elem.leq (root t, x) then root t else x
end
fun findMin [] = Elem.default
| findMin [t] = root t
| findMin (t :: ts) = helpFindMin (t, ts)
fun getMin (prevT, t) =
case t of
[t] => (t, [])