0 votes 0 votes P.S. Applied conditions given in " " is applicable on any(as per choice) Programming in C algorithms sorting + – Saurabh Gupta 1 asked Jul 28, 2015 Saurabh Gupta 1 2.0k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
4 votes 4 votes then the complexity will be O(a+b) because merge procedure isnt in place . And the comparisons required is min of a,b . Pranay Datta 1 answered Jul 28, 2015 edited Jul 28, 2015 by Pranay Datta 1 Pranay Datta 1 comment Share Follow See all 23 Comments See all 23 23 Comments reply Show 20 previous comments KOUSHIK commented Apr 12, 2016 reply Follow Share I GOT IT SIR ! thanx i was confused with it 1 votes 1 votes vijaycs commented May 12, 2016 reply Follow Share @Arjun Sir, Suppose array A has "a" elements and array B has "b" element and a>b And if b[0] >a[0] then in this case no. of comparison would be 'a' times. I think in the best case no. of comparison = min(a,b) And in the worst case no. of comparison = max(a,b) Please tell me sir where I am wrong. 0 votes 0 votes moin commented Mar 7, 2017 reply Follow Share O(a+b) is the right answer as number of comparison required is min(a,b) but we need to take the time of copying the remaining elements of larger list into the final list thats why time complexity is O(a+b) 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes if one array smallest element is greater than largest element of other one comparisons will be min(a,b)...this would be best case for merge procedure..one array would become empty so we can copy elements of another array.. Pooja Palod answered Aug 3, 2015 Pooja Palod comment Share Follow See all 4 Comments See all 4 4 Comments reply Arjun commented Aug 3, 2015 reply Follow Share yes. But time complexity would include copying too. 0 votes 0 votes Pooja Palod commented Aug 3, 2015 reply Follow Share yes time complexity will be O(n) only 0 votes 0 votes sushmita commented Nov 30, 2016 reply Follow Share will the no of comparisions remain min(a,b) even when we use setinel node(infinity)?? 0 votes 0 votes learner_geek commented Aug 11, 2017 reply Follow Share @pooja palod O(n) means (comparison+shifting both array into new array) max(a,b)+O(a)+O(b) right?? 0 votes 0 votes Please log in or register to add a comment.