Mergesort - Is Bottom-Up faster than Top-Down?

前端 未结 3 1271
清酒与你
清酒与你 2021-02-07 13:16

I\'ve been reading \"Algorithms, 4th Ed\" by Sedgewick & Wayne, and along the way I\'ve been implementing the algorithms discussed in JavaScript.

I recently took the

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-07 14:08

    I had asked the same question on coursera class forums for the 2012 August edition of this course. Professor Kevin wayne (of Princeton) replied that in many cases recursion is faster than iteration because of caching improved performances.

    So the short answer that I got at that time was that top down merge sort will be faster than bottom up merge sort because of caching reasons.

    Please note that the class was taught in Java programming language(not Javascript).

提交回复
热议问题