Sort 13 Discussions, By:
Please Login in order to post a comment
This problem is so convoluted, I still don't entirely understand the requirement after staring at the description and examples for over 10 minutes.
Solution with Haskell
Sample Output #02
2 9 6 4 1 3 7 5 11 8 10
Why inorder traverse prints '2' at the beginning when there is still left-tree under 2 has not been visited?
there is no clojure update function which is in version 1.7
please update your clojure
Hint: don't perform actual subtree swaps, just collect queries and take them into account while traversing tree.
I've implemented this in Erlang, works very well.