• retagged by
1,365 views
2 2 votes

Suppose we do merge sort with a three-way split: divide the array into 3 equal parts, sort each part and do a 3 way merge.

What would the worst-case complexity of this version be?

 

  1. O($n^2$)
  2. O($n^2$ log3n)
  3. O(n log2n)
  4. O(n $(log2n)^2$)  

1 Answer

Best answer
0 0 votes

C. O(n log2n) ...

 

# A variant of merge sort is called 3-way merge sort where instead of splitting the array into 2 parts we split it into 3 parts…

 

  ##  Merge sort recursively breaks down the arrays to subarrays of size half...

 

###  Similarly, 3-way Merge sort breaks down the arrays to subarrays of size one third...

 

1. https://en.wikipedia.org/wiki/Merge_sort

 

• selected by
Position:
Show:

Related questions

0 0 votes
1 1 answer
2.2k
2.2k views
rsansiya111 asked Dec 8, 2021
2,172 views
Suppose we want to extend the union-find data structure to support the operation Reset(c), which takes as input the name of a component c and then breaks up c into single...
0 0 votes
3 3 answers
1.8k
1.8k views
rsansiya111 asked Dec 8, 2021
1,773 views
Suppose there are k sorted lists (decreasing order) with n/k elements in each list.What is the time complexity to merge them into one single sorted list.Hint: Maintain a ...
0 0 votes
1 1 answer
7.8k
7.8k views
rsansiya111 asked Dec 8, 2021
7,804 views
. You are given a set of n points on the number line. They are given in arbitrary order. The task is to find the points that are closest to each other.To solve the proble...
0 0 votes
1 1 answer
601
601 views