Results 1 to 1 of 1
- 10-20-2011, 07:22 PM #1Member
- Join Date
- Oct 2011
- Rep Power
Java course evaluation assignment about binary search trees
hi i have a java evaluation course until java that is about binary serch trees....here is some of the words in the assignment... it's not the whole code i found...can somebody help me with the assignment???...it's until sunday midnight
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.
here is some of the code i try to modify
public class BinaryNode
protected Object element;
protected Object left;
protected int BinaryNode;
protected Object right;
* Creates a new tree node with the specified data.
* @param obj the element that will become a part of the new tree node
public BinaryNode(Object obj)
this.element = obj;
this.left = null;
this.right = null;
public BinaryNode (Object obj, int min, int max)
this.element = obj;
this.left = min;
this.right = max;
- By Alex_25 in forum Advanced JavaReplies: 6Last Post: 10-21-2011, 04:59 AM
- By Alex_25 in forum Forum LobbyReplies: 2Last Post: 10-20-2011, 12:35 AM
- By Get_tanked in forum New To JavaReplies: 4Last Post: 03-24-2011, 07:09 PM
- By girgishf in forum Advanced JavaReplies: 15Last Post: 11-20-2010, 05:29 PM
- By JordashTalon in forum New To JavaReplies: 3Last Post: 03-18-2009, 04:51 PM