0 0 votes P.S. Applied conditions given in " " is applicable on any(as per choice) Programming in C algorithms sorting + – Saurabh Gupta 1 4.6k views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
4 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 23 23 Comments reply Show 20 previous comments KOUSHIK commented Apr 12, 2016 reply Follow flag I GOT IT SIR ! thanx i was confused with it 1 1 replyShare vijaycs commented May 12, 2016 reply Follow flag @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 0 replyShare moin commented Mar 7, 2017 reply Follow flag 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 0 replyShare Please log in or register to add a comment.
0 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 4 4 Comments reply Arjun commented Aug 3, 2015 reply Follow flag yes. But time complexity would include copying too. 0 0 replyShare Pooja Palod commented Aug 3, 2015 reply Follow flag yes time complexity will be O(n) only 0 0 replyShare sushmita commented Nov 30, 2016 reply Follow flag will the no of comparisions remain min(a,b) even when we use setinel node(infinity)?? 0 0 replyShare learner_geek commented Aug 11, 2017 reply Follow flag @pooja palod O(n) means (comparison+shifting both array into new array) max(a,b)+O(a)+O(b) right?? 0 0 replyShare Please log in or register to add a comment.