Re: Java Newbie challenge
- From: "Momo" <arggaz@xxxxxxxx>
- Date: Thu, 14 Feb 2008 03:32:25 -0500
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
.
- Prev by Date: Re: Eclipse Book Help
- Next by Date: Re: Eclipse Book Help
- Previous by thread: Memory Issue
- Next by thread: Re: Java Newbie challenge
- Index(es):
Relevant Pages
|