467 views

2 Answers

0 votes
0 votes

dividing into many parts does not change the complexity of the algorithm.

dividing into 5 parts makes it O(log5n) that is O(log2n) or O(log n)

ps: log5n= log2n / log25 ;here log25 is a constant factor that we can ignore.this is the reason why we dont specify the base of log in O() notation.

so dividing into 5 parts does not change the complexity but the divide step to divide into 5 parts might be slower than that to divide into 2 parts and create further overhead in the algorithm. so we dont usually divide into more than 2 parts unless needed.

0 votes
0 votes
merge sort follows divide and conquer programming paradigm.the steps are 1)divide 2)solve sub problems 3) combine

the division step will still take o(1).

now,combine step will take o(n).

it simply will compare top element from 5 sorted sub arrays and put into temporary array.each element is compared with 4 other elements and we find min of those elements.so it take 4 comparsion instead of simply one in case of normal merge sort in worst case

so simply discard the constant.

if  you could understand the above explanation then deriving this would be easy task 4*N*logN/log5

Related questions

2 votes
2 votes
1 answer
1
Rajesh Pradhan asked Feb 22, 2016
479 views
#IITD_2011 A man is standing in front of an infinite wall with a hole on any side? How do u find the hole in shortest distance
1 votes
1 votes
2 answers
2
Rajesh Pradhan asked Feb 22, 2016
504 views
What is pipelining? Whats the need? Whats the funda behind it? Does it make the processor faster?