• Post Reply Bookmark Topic Watch Topic
  • New Topic

Q on Tree Structure Generation  RSS feed

 
Reshma Shanbhag
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I need to generate a Tree Structute. The Structure is some thing like this.

Is this structure possible to be created in java using either TreeMap or TreeSet, if no, then how could something like this be made possible.
This tree structure displayed is not for display purpose.
Hope to hear a solution soon
Reshma
 
Chris Smith
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, TreeSet and TreeMap are SortedSet and SortedMap classes that happen to be *implemented* using trees. They are not general-purpose classes for implementing a tree. Implementing an n-ary tree is not difficult, though. In fact, it's trivial. What's giving you difficulty?
 
Reshma Shanbhag
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chris,
Ya as mentioned the situation could be made possible with an n-array structure.
What stops me from using it?
I wanted to know if it could be done using TreeMap/TreeSet so that i can take advantage of the sun api. I need the data structured in a tree format for looking up data and retriving the same based on their unique identity in the system and not on index.
Any ways i got a way around with TreeMap with little bit of modifications.
Thanks
reshma

No, TreeSet and TreeMap are SortedSet and SortedMap classes that happen to be *implemented* using trees. They are not general-purpose classes for implementing a tree. Implementing an n-ary tree is not difficult, though. In fact, it's trivial. What's giving you difficulty?

[ May 06, 2003: Message edited by: Reshma Pai ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!