3 ms·
So... this solution - http://pastebin.com/JzjdPDUh http://pastebin.com/JzjdPDUh - written using LinqPad is not as complex as his preferred one and doesn't do th
by mdpopescu 12y ago
So... this solution - http://pastebin.com/JzjdPDUh http://pastebin.com/JzjdPDUh - written using LinqPad is not as complex as his preferred one and doesn't do three passes as the one in figure 5. Why is the complex one better?
- jonsen 12y agoThe "complex one" is better because it is correct. I don't know C#, but as I read your program, I'm pretty sure it's wrong. It seems like you just do a depth first traversal. That way you can't get breadth first numbering all the way through without further "complexity". It's pure luck, that you get his small tree right. Try a bigger tree.
- mdpopescu 12y agoI did try a bigger tree, it's still working correctly. (If it had been a depth-first search it would have been incorrect on that tree too - I know because I did write a depth-first search at first.)