3 ms·
Recursion is not the same as divide and conquer. Divide and conquer is a category of algorithms that you would often implement with recursion, but you don't hav
by aliceryhl 5y ago
Recursion is not the same as divide and conquer. Divide and conquer is a category of algorithms that you would often implement with recursion, but you don't have to.
For example, consider the bottom-up implementation of merge sort [1]. This implementation is not recursive, but merge sort uses divide and conquer regardless of whether or not you implement it top-down or bottom-up.
On the other hand, the naive fibonacci implementation that runs in exponential type is recursive, but it does not use divide and conquer.
[1]: https://en.wikipedia.org/wiki/Merge_sort#Bottom-up_implementation https://en.wikipedia.org/wiki/Merge_sort#Bottom-up_implement...