Results 1 to 7 of 7
 10192011, 10:40 PM #1Member
 Join Date
 Oct 2011
 Posts
 6
 Rep Power
 0
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 redblack 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 23Oct
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!!!!
 10192011, 11:29 PM #2Moderator
 Join Date
 Jul 2010
 Location
 California
 Posts
 1,641
 Rep Power
 9
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
 10192011, 11:38 PM #3Member
 Join Date
 Oct 2011
 Posts
 6
 Rep Power
 0
 10192011, 11:43 PM #4Member
 Join Date
 Oct 2011
 Posts
 6
 Rep Power
 0
 10202011, 12:42 AM #5
 Join Date
 Jan 2011
 Location
 Richmond, Virginia
 Posts
 3,069
 Blog Entries
 3
 Rep Power
 10
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.
 10202011, 09:45 AM #6
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 14,371
 Blog Entries
 7
 Rep Power
 25
Re: Java course evaluation assignment about binary search trees, emergency help!!!
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,
JosThe only person who got everything done by Friday was Robinson Crusoe.
 10212011, 03:59 AM #7Member
 Join Date
 Feb 2011
 Posts
 24
 Rep Power
 0
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

Java course evaluation assignment about binary search trees
By Alex_25 in forum Forum LobbyReplies: 2Last Post: 10192011, 11:35 PM 
HELP!! Binary trees
By Get_tanked in forum New To JavaReplies: 4Last Post: 03242011, 07:09 PM 
Binary trees
By girgishf in forum Advanced JavaReplies: 15Last Post: 11202010, 05:29 PM 
Tutorial on Binary Search Trees
By JordashTalon in forum New To JavaReplies: 3Last Post: 03182009, 04:51 PM 
Binary Search in Java
By Java Tip in forum AlgorithmsReplies: 0Last Post: 04152008, 07:43 PM
Bookmarks