• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Q on Tree Structure Generation

 
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
eat bricks! HA! And here's another one! And a tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic