2008/11/20 Hugh Sasse <
[email protected]>:
Well, isn't this (i.e. analyzing the problem) part of your assignment?
This really looks like a homework assignment...
How do I visit the child here? Which ones are trees in the same level?
In the Pastie the keys point at arrays of strings. But in that example
all the strings correspond to keys, except for lonelygirl13 which looks
like a typo for the key lonelygirls13. Normally to make a tree with
hashes you'd use hashes of hashes [of hashes [...]]. It seems to me
you can't do Breadth first until you've got some Depth to not do first!
Hugh, not necessarily. You just need to look at the Hash as a vertex
collection. I'm not going to say more...
Definitely agree with robert here. But the $database seems contrived.
I would guess the powers that be want you to come up with a clever way
to check your nodes. To be honest my first solution (that I thought
was clever) turned out to walk each node from left to right, but just
wasn't even close to bfs. Your parent node, with this type of hash,
is probably supposed to be the first one, and then stack them from
there.
Todd