Skip to content
Snippets Groups Projects
Commit b9130af8 authored by Etienne Kneuss's avatar Etienne Kneuss
Browse files

Size should be a bigint, otherwise we have overflows in large trees

parent 4faeafe3
No related branches found
No related tags found
No related merge requests found
...@@ -14,7 +14,7 @@ object RedBlackTree { ...@@ -14,7 +14,7 @@ object RedBlackTree {
case Node(_, l, v, r) => content(l) ++ Set(v) ++ content(r) case Node(_, l, v, r) => content(l) ++ Set(v) ++ content(r)
} }
def size(t : Tree) : Int = t match { def size(t : Tree) : BigInt = t match {
case Empty() => 0 case Empty() => 0
case Node(_, l, v, r) => size(l) + 1 + size(r) case Node(_, l, v, r) => size(l) + 1 + size(r)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment