This is actually a 2-part question:
1) I need to create some sort of "tree" structure. I'm not sure the best way to do that in perl (I'd use linked lists in other languages, but I'm not sure how to use perl linked lists...if perl even has that capability). The tree is pretty simple...just a "name" and "value" at each node.
2) Once I get a tree structure, I need to determine the deepest branches...from deepest to shallowest...based on the value on each node. So, for example, I want to find the deepest to shallowest branches where there are consecutive values of "1" on the nodes. (I hope that makes sense).
Here is an example:
(a,1)->(b,1)->(c,2)->(d,1)
(a,1)->(e,1)->(f,1)
I would want the following information, when looking for consecutive 1's:
max_depth = 3 => a->e->f
depth = 2 => a->b
min_depth = 1 => d
Any ideas where to even begin on this one?!?!?!?!
Thanks in advance!!!
1) I need to create some sort of "tree" structure. I'm not sure the best way to do that in perl (I'd use linked lists in other languages, but I'm not sure how to use perl linked lists...if perl even has that capability). The tree is pretty simple...just a "name" and "value" at each node.
2) Once I get a tree structure, I need to determine the deepest branches...from deepest to shallowest...based on the value on each node. So, for example, I want to find the deepest to shallowest branches where there are consecutive values of "1" on the nodes. (I hope that makes sense).
Here is an example:
(a,1)->(b,1)->(c,2)->(d,1)
(a,1)->(e,1)->(f,1)
I would want the following information, when looking for consecutive 1's:
max_depth = 3 => a->e->f
depth = 2 => a->b
min_depth = 1 => d
Any ideas where to even begin on this one?!?!?!?!
Thanks in advance!!!