Results 1 to 7 of 7
  1. #1
    Jumanji245 is offline Member
    Join Date
    May 2011
    Posts
    5
    Rep Power
    0

    Default Java Balancing Tree, I have no idea how to do this can some one help me PLEASE

    (14pts) Below is the diagram to rebalance an AVL tree when the AVL condition is violated at the node P because of an insertion to the right of P's left child.

    Complete the method doubleWithLeftChild(Node p) below that (1) rebalances the tree at P, (2) adjusts the heights of nodes whose children have changed, and (3) returns a reference to the new root node R of the rebalanced subtree.



    Node doubleWithLeftChild(Node p)
    {

    }

    where the Node structure is private class Node
    {
    public E data;
    public Node left;
    public Node right;
    public int height;

    public Node() { height = -1; }
    public Node(E d) { data = d; height = 0; }

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,397
    Rep Power
    25

    Default

    Do you have the algorithm for this problem?

  3. #3
    Jumanji245 is offline Member
    Join Date
    May 2011
    Posts
    5
    Rep Power
    0

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,397
    Rep Power
    25

    Default

    Nice picture.
    What is your design for the code you want to write?

  5. #5
    Jumanji245 is offline Member
    Join Date
    May 2011
    Posts
    5
    Rep Power
    0

    Default

    Quote Originally Posted by Norm View Post
    Nice picture.
    What is your design for the code you want to write?
    I thought this was all i needed to do, this is all i he gave us

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,397
    Rep Power
    25

    Default

    Time to do some research and find an algorithm to solve the problem. I'm sure Google will find one.
    Once you have the algorithm, then you can think about how to turn it into java code.

  7. #7
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

Similar Threads

  1. Need help with idea of java css web browser
    By skorpikon in forum New To Java
    Replies: 2
    Last Post: 05-03-2011, 08:11 AM
  2. load balancing
    By hemant_metalia in forum Networking
    Replies: 0
    Last Post: 02-23-2011, 04:54 AM
  3. java Socket Load balancing
    By rajeshsun69 in forum Networking
    Replies: 0
    Last Post: 12-17-2010, 11:25 AM
  4. Need a project idea in java.
    By vinoth in forum Java Software
    Replies: 5
    Last Post: 10-11-2009, 09:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •