Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2006

Tip: Looking for answers? Try searching our database.

binarytree

Thread view: 
neapolisratio - 21 Dec 2006 19:13 GMT
please help me.......:
i have to implement a binary tree throgh a vector.How can i do?
Situation:
public class VectorBinaryTree<E> implements BinaryTree<E> {
.
.
.
.
.
}
I thinked to use an adaptern pattern like a IndexList<E>
(ArrayIndexList<E> who implement IndexList<E>), but my binarytree use
the Position concept, and a vector not.
How can i override the methods without make wrong?
my http://ww0.java4.datastructures.net/

i have the exam next month....and believe me......don't know how to
save me....
Flo 'Irian' Schaetz - 21 Dec 2006 19:22 GMT
And thus spoke neapolisratio...

> i have to implement a binary tree throgh a vector.How can i do?

Simply think about where to place each node. Start with the root. Add
the child-nodes. Add THEIR child-nodes. etc. You'll see that you can
calculate each node's position in the vector (as long as you assume a
completly filled binary tree). Use google with "Binary tree array" and
you'll find something.

Flo
Phi - 22 Dec 2006 07:32 GMT
I dont know, if this does it ... but anyway: have a look at the "TreeList".

org.apache.commons.collections.list.TreeList

greetings

phi

> please help me.......:
> i have to implement a binary tree throgh a vector.How can i do?
[quoted text clipped - 14 lines]
> i have the exam next month....and believe me......don't know how to
> save me....
Patricia Shanahan - 22 Dec 2006 15:35 GMT
...
> I thinked to use an adaptern pattern like a IndexList<E>
> (ArrayIndexList<E> who implement IndexList<E>), but my binarytree use
> the Position concept, and a vector not.

Vector has a concept of position. See the get and setElementAt methods.

Patricia


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.