3 ms·
Just take the good ol' classical example of quicksort in Haskell or fibonacci in Lisp. Hell, recursive quicksort and mergesort are easier to teach and remember
by kyllo 12y ago
Just take the good ol' classical example of quicksort in Haskell or fibonacci in Lisp.
Hell, recursive quicksort and mergesort are easier to teach and remember than the iterative versions even in C and Java. They're divide-and-conquer algorithms, which makes them a natural fit for a recursive solution.
- splinterofchaos 12y agoThe classic C/C++ versions are recursive, and using the STL, c++'s quick sort looks very similar to the functional one. From cppreference.com: http://coliru.stacked-crooked.com/view?id=0b2cec4d8c69ffaf http://coliru.stacked-crooked.com/view?id=0b2cec4d8c69ffaf http://en.cppreference.com/w/cpp/algorithm/partition http://en.cppreference.com/w/cpp/algorithm/partition