Search:

Type: Posts; User: Parranoia

Search: Search took 0.07 seconds.

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

    No problem. Always helps to have someone else to talk a problem through.
  2. Re: Getting height of binary search tree without using recursion

    I knew there had to be something wrong with it. Perhaps you could check if it's the first node being added to the parent before adding to the height.
    So if the parent already has one child, don't...
  3. Re: Getting height of binary search tree without using recursion

    Okay, so after thinking for a bit I might have some insight.
    When you add a node, add 1 to the parent's height. This effect should give the bottom row a height of 0 (or 1 depending on how you're...
  4. Re: Getting height of binary search tree without using recursion

    Ohhh, gotcha. Height, not size.
    Were you told whether or not the tree is balanced? If it must be balanced then this could be done a bit easier. If not, I'm not too sure I have a solution right off.
  5. Re: Getting height of binary search tree without using recursion

    Well, since you added the h field, you should first initialize it to 0 when the tree is first created. Then once a node is added to the tree, increment the height by one. When a node is removed,...
Results 1 to 5 of 5