Results 1 to 7 of 7
  1. #1
    Alex_25 is offline Member
    Join Date
    Oct 2011
    Posts
    6
    Rep Power
    0

    Exclamation Java course evaluation assignment about binary search trees, emergency help!!!

    I have a course evaluation assignment about binary search trees and idk how to do it?
    That assignment is a combination of red-black trees and binary search trees in general and is until sunday at midnight,if anyone can help me somehow with the implementation and test or give me some hints how to do something, at least some simple program.
    Here it is what it says:
    Your solution of this assignment must be handed in before Sunday 23-Oct-
    2011 at 23:59. It will be a part of the evaluation of the course. If you fail
    this assignment you will fail the course.
    The assignment is individual. Similar solutions from different persons will not
    be accepted.
    In this assignment you have to design and implement a “Hit Balanced Tree”
    (HBT). HBT is a new data structure invented for this assignment and it might
    not be of any use in real programs.
    An HBT is an ordinary binary search tree where all the nodes contain an
    extra attribute – number of hits. When a node is created the hit count is set
    to zero. Every time the node is found with the find(), contains() etc.
    methods its hit count is incremented by one.
    When an HBT is balanced, all the descendants of a node have lower hit count
    than the node itself. On the other hand, it is still a search tree, where all
    nodes in the left subtree of node have elements smaller than the element of
    the node, and corresponding greater than for the right subtree.
    In other words: the root will be the node with the highest hit count. To the
    left are the smaller elements and the larger element are to the right. This
    rule is applied recursively down both the subtrees.
    Implement an HBT and make a proper test of your implementation.

    pls i need some help, i would be really gratefull :D :D if it's possible something simple without generics and exceptions, HEEEEELP, at least some hints for something easy!!!!

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

    Default Re: Java course evaluation assignment about binary search trees, emergency help!!!

    Don't double post: Java course evaluation assignment about binary search trees
    And ask a specific question rather posting an assignment . Recommended reading: How To Ask Questions The Smart Way

  3. #3
    Alex_25 is offline Member
    Join Date
    Oct 2011
    Posts
    6
    Rep Power
    0

    Default Re: Java course evaluation assignment about binary search trees, emergency help!!!

    Quote Originally Posted by doWhile View Post
    Don't double post: Java course evaluation assignment about binary search trees
    And ask a specific question rather posting an assignment . Recommended reading: How To Ask Questions The Smart Way
    thanks, but i don't have some specific question, i just simply need help with the assignment :D :D :D

  4. #4
    Alex_25 is offline Member
    Join Date
    Oct 2011
    Posts
    6
    Rep Power
    0

    Exclamation Re: Java course evaluation assignment about binary search trees, emergency help!!!

    Quote Originally Posted by doWhile View Post
    Don't double post: Java course evaluation assignment about binary search trees
    And ask a specific question rather posting an assignment . Recommended reading: How To Ask Questions The Smart Way
    i don't have some specific question, i just need a bit of help about everything that's why i have post the whole assignment

  5. #5
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default Re: Java course evaluation assignment about binary search trees, emergency help!!!

    Don't use the word emergency, urgent, etc. It will make you lose help. A huge wall of text is also going to limit responses.

  6. #6
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,513
    Blog Entries
    7
    Rep Power
    20

    Default Re: Java course evaluation assignment about binary search trees, emergency help!!!

    Quote Originally Posted by Alex_25 View Post
    When an HBT is balanced, all the descendants of a node have lower hit count
    than the node itself. On the other hteand, it is still a search tree, where all
    nodes in the left subtree of node have elements smaller than the element of
    the node, and corresponding greater than for the right subtree.
    In other words: the root will be the node with the highest hit count.
    That paragraph says it all: for a parent node P and children L and R, the hit countt of P is higher than the counts of L and R. If the hit count of, say, L increases and becomes larger than P's hit count you have to rotate the tree, i.e. the original tree (P (L R)) becomes (L (- (P (- R)))) and you recursively apply the rotation to the new root node L. The same applies for node R. (- indicates a null sub tree)

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  7. #7
    kennyman94 is offline Member
    Join Date
    Feb 2011
    Posts
    24
    Rep Power
    0

    Default Re: Java course evaluation assignment about binary search trees, emergency help!!!

    basically, just write a compareTo method for the tree's elements and, everytime something is hit on the tree, call Collections.sort on it. I think that a TreeSet's
    elements are only compared to each other when the structure of the set is modified. That is why i suggest manually calling the sort method whenever an element's
    state changes in a way that invalidates the order of the tree.

Similar Threads

  1. Replies: 2
    Last Post: 10-19-2011, 11:35 PM
  2. HELP!! Binary trees
    By Get_tanked in forum New To Java
    Replies: 4
    Last Post: 03-24-2011, 06:09 PM
  3. Binary trees
    By girgishf in forum Advanced Java
    Replies: 15
    Last Post: 11-20-2010, 04:29 PM
  4. Tutorial on Binary Search Trees
    By JordashTalon in forum New To Java
    Replies: 3
    Last Post: 03-18-2009, 03:51 PM
  5. Binary Search in Java
    By Java Tip in forum Algorithms
    Replies: 0
    Last Post: 04-15-2008, 07:43 PM

Posting Permissions

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