0 votes 0 votes no of comparisons in merge sort max? how many max no swaps??[if inplace algo] Algorithms algorithms sorting merge-sort + – Abhisek Tiwari 4 asked Nov 24, 2018 • retagged Jun 20, 2022 by makhdoom ghaya Abhisek Tiwari 4 644 views answer comment Share Follow See all 2 Comments See all 2 2 Comments reply raahul commented Nov 24, 2018 reply Follow Share Number of comparison will be nlogn for merge sort. There are logn levels each level has comparisons equal to n. 0 votes 0 votes Shamim Ahmed commented Nov 25, 2018 reply Follow Share https://stackoverflow.com/questions/8535540/exactly-how-many-comparisons-does-merge-sort-make 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes in the worst case n^2 swaps. max. swap occur when array will be like this [(3,4),(1,2)] or [(5,6,7,8)(1,2,3,4)]. https://www.geeksforgeeks.org/in-place-merge-sort/ (use this algo to calculate no. of swaps). Correct me if i'm wrong? Spidey_guy answered Jan 3, 2020 Spidey_guy comment Share Follow See all 0 reply Please log in or register to add a comment.