Re: Java Newbie challenge



Hi
You have a lot of structures to do that.
The java built in structures are, for example, all of the collection
structures (vectors, hash tables, ... - for that, takes a look on the java
API javadoc).
You can also use the XML as a structured manner to represent your tree and
after that use parsers (like DOM, ...). They have writen methods to do a lot
of processing on the XML docs (representing trees and processing them like
finding childrens....).
Good luck
Mohand



"Roedy Green" <see_website@xxxxxxxxxxxxxxxxxxxx> a écrit dans le message de
news: tus7r3p6ku1s7v3anvll7ciqs3gvhfq628@xxxxxxxxxx
I was watching a PBS show on genealogy of people with African roots. I
started thinking about what sort of Java structures could you use to
store a tree in RAM.

Each child has 2 parents2, 4 grandparents, 8 grandparents etc.

You could use objects with a mother and father parent pointer.

Or you could use an array of pointers from a parent to all their
children, or both.

You might even store all this is a an array like this:

child
mother
father
maternal grandmother
maternal grandfather
paternal grandmother
paternal grandfather
...

What real world conditions can throw a monkey wrench into this?

The biggie is this. If you have 64 greatgrandparents, 128 great great
grandparents, etc. it won't take long until you have more great^n
grand parents than the population of the world at the time. What
happened?

So devise a datastructure to hold a family tree.
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com


.



Relevant Pages

  • RE: Add Child Node to Treeview
    ... thinking yesterday afternoon that perhaps one way to get a unique strKey is ... into the!Parent section. ... 'Fill Tree ... qryFamTree has my main table joined to a second table by WhoID. ...
    (microsoft.public.access.formscoding)
  • Re: How to populate a treeview from a dataset
    ... If it is then check to see if the parentId and child id of the ... 15 is a parent and a child of itself. ... And that same business is the headquarters for the purchasing group. ... 15 Null - root tree node, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How to populate a treeview from a dataset
    ... If it is then check to see if the parentId and child id of the ... 15 is a parent and a child of itself. ... And that same business is the headquarters for the purchasing group. ... 15 Null - root tree node, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Add Child Node to Treeview
    ... You cannot use the same value for strKey for multiple nodes. ... even though they refer to the same child. ... When I base the tree on this query I get ... 'Find the parent node and add it below that node's last child ...
    (microsoft.public.access.formscoding)
  • [git patches] 2.6.x libata fixes
    ... Here are some moderately important libata fixes. ... tree bd6a8c952ca83863e731e93d332a9cdc2a21563e ... parent 104e50108c862b13da26850d4b469cc13418b66b ... before the SCSI error handler, and it clears the command by calling ...
    (Linux-Kernel)