CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced: Tree Hierarchy: Edit Log



sriharsha_12
Novice

Oct 4, 2011, 2:05 AM


Views: 3597
Tree Hierarchy

I have an interesting problem. consider the below tree structure,

....................a
................/.....\
................b......c
............../..\....|
.............d....e...b
....................../..\
......................d...e

if the input is 'e', i need to print
e - b - a & e - b - c - a
if input is c,
c - a

i need to write a perl script which applies for any given tree structure.

i generated a hash,

a => -
b => a,c
c => a
d => b
e => b

here i'm stuck in writing an algo that prints any given tree.

any ideas?


(This post was edited by sriharsha_12 on Oct 5, 2011, 2:01 AM)


Edit Log:
Post edited by sriharsha_12 (Novice) on Oct 5, 2011, 2:01 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives