Search:

Type: Posts; User: berserker

Search: Search took 0.16 seconds.

  1. Re: Getting height of binary search tree without using recursion

    Yes, I think that's the proper strategy. I'll see if I can write out the code and if it works I'll post it here for other users to benefit from. Thanks for your help by the way! :cool:
  2. Re: Getting height of binary search tree without using recursion

    You're close. However, a node can have two children. So, say for instance that you add a left child; you would then add 1 to the height of it's parent. But, then if you add a right child, you'd...
  3. Re: Getting height of binary search tree without using recursion

    The tree can be unbalanced. The easiest way to do it would be through recursion like below but we aren't allowed to do it that way:

    public int height() {
    return height(root);
    }

    ...
  4. Re: Getting height of binary search tree without using recursion

    But wouldn't that just give me the total number of nodes? The height is not the same as the total number of nodes. It's the longest path from the root to any child node.

    For instance for the...
  5. Getting height of binary search tree without using recursion

    Hello. I'm stuck on a homework problem and could use some help if someone would be so kind as to help a beginner understand Java. I'm having some trouble trying to get the height of a binary search...
Results 1 to 5 of 5