Search:

Type: Posts; User: Norm

Search: Search took 0.15 seconds.

  1. Replies
    41
    Views
    2,829

    Re: find largest value in BST

    Glad you got it working.
  2. Replies
    41
    Views
    2,829

    Re: find largest value in BST

    It needs to use the returned value.
  3. Replies
    41
    Views
    2,829

    Re: find largest value in BST

    What does the debugging output show?

    Why isn't the value returned by inorderHelper() used????
  4. Replies
    41
    Views
    2,829

    Re: find largest value in BST

    Can you explain why there are three double args to the method? The code only needs to have the current max to compare against.

    The method should ALWAYS return the max found so far. Never 0!!!
  5. Replies
    41
    Views
    2,829

    Re: find largest value in BST

    How about another arg for the method: currMax
  6. Replies
    41
    Views
    2,829

    Re: find largest value in BST

    You need to have the current max value available as you transit the tree so you can test if the current node's value is bigger.
  7. Replies
    41
    Views
    2,829

    Re: find largest value in BST

    Save what the method returns in a variable.
  8. Replies
    41
    Views
    2,829

    Re: find largest value in BST

    The inorderHelper() method looks like its a start in the right direction.
    Some comments:
    1)What are the x,y variables for? x,y would look like a position in a 2D graph not part of a search for a...
  9. Replies
    41
    Views
    2,829

    Re: find largest value in BST

    Here's what prints out with:

    System.out.println(root);
    when there is a toString() method in the Node class.

    { S=Hyena, d=0.53, l={ S=Hamster, d=0.29, l={ S=Beetle, d=1.04, l={...
  10. Replies
    41
    Views
    2,829

    Re: find largest value in BST

    Please post the debug output on the forum.

    I don't see the toString() method in the Node class.

    The printlns generate too many lines of output. x and y could be printed on the same line.

    ...
  11. Replies
    41
    Views
    2,829

    Re: find largest value in BST

    I don't see any debugging output when the program executes. All it prints is: 1.04

    For testing I'd make as small a tree as possible to keep the debug print out down.
  12. Replies
    41
    Views
    2,829

    Re: find largest value in BST

    Which post is the code in? Posts are numbered in upper right. This is post #19
  13. Replies
    41
    Views
    2,829

    Re: find largest value in BST

    Please post code for testing that will compile, execute and show the problem. What you posted won't compile.
  14. Replies
    41
    Views
    2,829

    Re: find largest value in BST

    Do you have code that will compile, execute and show what you are talking about?
  15. Replies
    41
    Views
    2,829

    Re: find largest value in BST

    The two suggestions go together. By adding a toString() method to the Node class and then printing root( a Node) the compiler will generate calls to the Node class's toString() method that will...
  16. Replies
    41
    Views
    2,829

    Re: find largest value in BST

    It would have to look at all the nodes.
  17. Replies
    41
    Views
    2,829

    Re: find largest value in BST

    You don't need another file for testing. You need to verify that the file you posted shows the error,

    If the code only looks on one side of the tree, how will it find something that could be on...
  18. Replies
    41
    Views
    2,829

    Re: find largest value in BST

    If you have not used the file and proved that it causes the error, then it is a waste of time for me to use it. You need to post data that causes the error.
  19. Replies
    41
    Views
    2,829

    Re: find largest value in BST

    What's in the file it ties to read?

    I'm done for tonight, back tomorrow.
  20. Replies
    41
    Views
    2,829

    Re: find largest value in BST

    How can we test the code to see how it works?
Results 1 to 20 of 20