This week's book giveaway is in the Artificial Intelligence forum.
We're giving away four copies of Pragmatic AI and have Noah Gift on-line!
See this thread for details.
Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Q on Tree Structure Generation  RSS feed

 
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
 
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 ]
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!