Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Number of Comparisons using merge sort

If you have 5 distinct numbers, how many comparisons at most do you need to sort this using merge sort?

like image 936
DarthVader Avatar asked Oct 04 '09 19:10

DarthVader


Video Answer


1 Answers

What is stopping you from coding a merge sort, keeping a counter for the number of comparisons in it, and trying it out on all permutations of [0,1,2,3,4]?

like image 103
MAK Avatar answered Sep 24 '22 20:09

MAK