Working with Datatypes (Cont)
fun
insert (i, NULL) = L(i) |
insert (i, L(j)) =
if i < j then I(j,L(i),NULL)
else I(j,NULL,L(i)) |
insert (i, I(j, ls, rs)) =
if i=j then I(j, ls, rs)
else if i < j then I(j, insert(i,ls),rs)
else I(j, ls, insert(i, rs));
Previous slide
Back to first slide
View graphic version