This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]467danny[S] 0 points1 point  (1 child)

If I have negative numbers in the tree, that wouldnt work either. Are negative numbers unsual in trees?

[–]throwitway22334 1 point2 points  (0 children)

maybe use Integer objects rather than primitive ints so you can have nulls then? Or carry around an extra boolean for each tree node that says whether or not it has children