Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #10402
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nx02.iad01.newshosting.com!novia!news-out.readnews.com!transit4.readnews.com!nx01.iad01.newshosting.com!newshosting.com!69.16.185.51.MISMATCH!isp-post01.iad!news.highwinds-media.com!not-for-mail |
|---|---|
| Date | Thu, 01 Dec 2011 10:39:43 -0500 |
| From | Wayne <nospam@all.invalid> |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0 |
| MIME-Version | 1.0 |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Collection to implement linked structure traverse up and down |
| References | <68dffbe9-ba9e-4daa-9bab-deac913b2cfe@t38g2000prg.googlegroups.com> <ViKAq.67226$yY3.16931@newsfe01.iad> |
| In-Reply-To | <ViKAq.67226$yY3.16931@newsfe01.iad> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | 7bit |
| Lines | 50 |
| Message-ID | <4ed79fbb$0$9866$9a6e19ea@unlimited.newshosting.com> (permalink) |
| Organization | Newshosting.com - Highest quality at a great price! www.newshosting.com |
| NNTP-Posting-Host | 97.76.166.205 |
| X-Complaints-To | abuse@newshosting.com |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:10402 |
Show key headers only | View raw
On 11/28/2011 6:32 AM, Arved Sandstrom wrote: > On 11-11-28 03:53 AM, ruds wrote: >> Hi, >> I want to implement a tree or a linked structure where I can traverse >> to the parent of a node also and the same node refers to another data >> related to it too. >> for example i have a set [0,1,2,3,...10], consider these as levels, >> so ) will be at top i.e the root, 1 will be first level, and so on. >> each of these levels will again have some branches and some data needs >> to be referenced with this too for comparison with another similar >> tree of this kind. Also, once I get the comparion of the branch X done >> I need to traverse to its parent level and it higher level. >> I think TreeMapClass and LinkedHashMapClass will be helpfull to me in >> this regard. >> This need not be a tree, it can be a linked list too. >> Please tell me am i on the right path? Kindly, suggest the >> implementation too. > > If I understand you correctly, one of your requirements is that each > node of the data structure has associated user data, which is distinct > from references to other nodes. This is common. > > The distinguishing feature of a node for a singly linked list is that it > has a reference to a "next" sibling. Nodes for doubly linked lists have > two references, one to a "previous" sibling, one to a "next" sibling. > Nodes for a binary tree have zero, one or two references, where any > reference is to a "child". Any or all of these nodes can be implemented > with objects that have not only the required references but also > variable, user-defined data. > > It's also helpful to distinguish between concept and implementation. At > this stage we're talking concepts, and the language is clearly that of > trees. In particular where you are talking about tree comparisons this > is all very standard stuff...although your determination of how two > trees compare will typically not start at the bottom. > > I don't think TreeMap or LinkedHashMap will help you much. These are > both maps. You can distort them into trees but that's not their intended > purpose. If you're looking to locate a starting implementation you could > do worse than use javax.swing.tree.TreeModel (implementation class > javax.swing.tree.DefaultTreeModel) and javax.swing.tree.TreeNode > (MutableTreeNode, DefaultMutableTreeNode). These are general purpose and > don't have to be used with Swing at all. > > AHS In addition to javax.swing.tree.*, take a look at the org.w3c.dom.Node. -- Wayne
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Collection to implement linked structure traverse up and down ruds <rudranee@gmail.com> - 2011-11-27 23:53 -0800
Re: Collection to implement linked structure traverse up and down Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-11-28 07:32 -0400
Re: Collection to implement linked structure traverse up and down Wayne <nospam@all.invalid> - 2011-12-01 10:39 -0500
Re: Collection to implement linked structure traverse up and down ruds <rudranee@gmail.com> - 2011-12-04 23:57 -0800
Re: Collection to implement linked structure traverse up and down Lew <lewbloch@gmail.com> - 2011-12-05 15:08 -0800
Re: Collection to implement linked structure traverse up and down ruds <rudranee@gmail.com> - 2011-12-05 21:55 -0800
Re: Collection to implement linked structure traverse up and down Roedy Green <see_website@mindprod.com.invalid> - 2011-11-29 17:01 -0800
Re: Collection to implement linked structure traverse up and down Henk van Voorthuijsen <voorth@xs4all.nl> - 2011-12-05 02:41 -0800
Re: Collection to implement linked structure traverse up and down Martin Gregorie <martin@address-in-sig.invalid> - 2011-11-30 21:17 +0000
csiph-web