TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


Forums >


Algorithm making tree from shuffle nodes


5/17/2016 4:08:00 PM

I search algorithm to make tree or trees (forest) from random shuffle nodes where each node has own key (unique hash) and has parent key.
I list childs can be before parent.
For example
A has three children B, C and D
First we meet B - store as tree without parent, next C - second tree. Next A - it is parent od B and C - make one tree with 3 nodes.
Meet D - it easy - unordered map helps us find A and join to tree.