1,199 views

4 Answers

2 votes
2 votes
we have 4 sorted list each of 8 element(keys)
1 list .
2 list
3 list
4 list
now  to merge  first  two list i.e.

 list 1 list 2 we need (m+n-1) comparison  =15..........................LIST A(16 element)

 list 3 list 4 we need (m+n-1) comparison  =15........................... LIST B(16 element)
 now to merge these two we require   (16+16-1)=31
total 15+15+31=61
0 votes
0 votes
isanswer 61?
0 votes
0 votes

Number of comparisons requires : $nlogn-2^{^logn}+1$ (Formula)

so , substituting values in formal:

8*3-8+1=17.

since there are 4 lists : 4*17= 68.

And now it is mentioned in question that list is sorted so all (n-1) elements are sorted so we have to remove it from counting comparisons: 68-7= 61.

http://stackoverflow.com/questions/12346054/number-of-comparisons-in-merge-sort

0 votes
0 votes
Using the merge algorithm.. If one sorted list has m elements and another has n elements then it requires m+n-1 comparisons during merging of list in worst case...

There are four list of 8 elements.. First two list requires 8+8-1=15 comparison and another two list requires 8+8-1=15 comparison.. Now we have two list of 16 elements, the number of comparison required is 16+16-1=31 comparison..

Total we have 15*2+31=61 comparison

Related questions

0 votes
0 votes
0 answers
3
Nandkishor3939 asked Jan 21, 2019
698 views
What is the extra memory needed for merge sort:1] In case of Iterative merge sort.(DS:Array)2]In case of Recursive merge sort.(DS:Array)3] In case of Iterative merge sort...
0 votes
0 votes
0 answers
4
Vikas123 asked Jan 8, 2019
1,034 views
Can anyone help me to understand this problem….??