Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!usenet.ukfsn.org!not-for-mail From: Martin Gregorie Newsgroups: comp.lang.java.programmer Subject: Re: Collection to implement linked structure traverse up and down Date: Wed, 30 Nov 2011 21:17:13 +0000 (UTC) Organization: UK Free Software Network Lines: 29 Message-ID: References: <68dffbe9-ba9e-4daa-9bab-deac913b2cfe@t38g2000prg.googlegroups.com> NNTP-Posting-Host: 84.45.235.129 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: localhost.localdomain 1322687833 5463 84.45.235.129 (30 Nov 2011 21:17:13 GMT) X-Complaints-To: usenet@localhost.localdomain NNTP-Posting-Date: Wed, 30 Nov 2011 21:17:13 +0000 (UTC) User-Agent: Pan/0.135 (Tomorrow I'll Wake Up and Scald Myself with Tea; GIT 30dc37b master) Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:10378 On Sun, 27 Nov 2011 23:53:30 -0800, 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. > The main problem is that, unless I missed something, none of the standard Tree* classes implement a getParent() method - if you need that operation you'll probably need to implement a red-black tree or Btree yourself, but once that's done there's no reason why each node shouldn't use some Collection class to hold your data items. -- martin@ | Martin Gregorie gregorie. | Essex, UK org |