I need to generate a node list for some network devices I manage and I need it to be in a hierarchical structure when I am done.
I have the following list that is generated where the fist item it the child and the second item is the parent:
b:a c:a d:b e:c f:c
And it needs to look like this when I am done:
+-b--d a -+ + +-e +-c-+ +-f
I can parse out my input and basically generate the first list in an array or hash. But, what I am not sure of is how to generate the final data structure as I need to loop through the original list and come up with the hierarchy relationships. I have no idea how to store this either.
Any help with this would be appreciated.
2006-03-22 Retitled by planetscape, as per Monastery guidelines
Original title: 'a complex data structure'
In reply to how to construct tree from parent pointer list by bfdi533
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |