Welcome Guest, Not a member yet? Register   Sign In
Coding Geniuses: Answer this Question Please (best answer gets $20)
#12

[eluser]dtrenz[/eluser]
Yes, there are a couple of assumptions required for my code to work. These should probably be addressed so that the function is more generic.

(1) The original array element order matters.
The elements need to be in order, so that no element should be listed until it's parent element has been added.


(2) The first element must be the top most parent
The elements need to be in order, so that the first element is the top-most parent.


There are obvious flaws to this logic, but it should be simple enough to fix these restrictions. I'll see if I can't fix these.

This sorting algorithm was just done on-the-fly and from scratch.


Messages In This Thread
Coding Geniuses: Answer this Question Please (best answer gets $20) - by El Forum - 03-20-2008, 01:16 PM



Theme © iAndrew 2016 - Forum software by © MyBB