[Cologne-pm] table zu tree konvertieren
Johannes Huettemeister
j.huettemeister at googlemail.com
Thu Nov 16 04:14:36 PST 2006
Hallo Zusammen,
ich bin nicht gerade der Algorythmiker schlechthin, vielleicht habt Ihr
einen Denkanstoß:
Ich habe eine Tabelle wie diese:
Node_id Parent_id
101 202
202 303
145 132
132 303
303 -1
...
...
Über diese Abhängigkeit möchte ich jetzt einen Tree bilden. Ich hoffe ihr
könnt auf ASCII-Art verzichten;-)
Soweit bin ich:
push @{$h{$parent_id}}, $parent_id;
Jetzt muß ich irgendwie rekursiv einen neuen hash bauen.
Ich wette das ist 1. Semester Informatik, aber da hab ich gefehlt ;-)
cheers, Johannes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/cologne-pm/attachments/20061116/4577aa91/attachment.html
More information about the Cologne-pm
mailing list