say we hav array {101,102,103,104(ptr1),1,2,3,4(ptr2)}
1.take end of 1 st array in ptr1 & end of 2nd array in ptr2
2.IF (ptr1>ptr2)
bubble up ptr1 to ptr2;
ptr2--
ptr1--
ELSE
ptr2--;
1.compare last element of both arrays ie 104 & 4 since 104>4
bubble up 104 to end since it will be greater than whole 2 nd array
so {101,102,103(ptr1),1,2,3,4(ptr2),104}
moving on............
ex 2 : {1,3,5,7(ptr1),2,4,6,8(ptr2)}
7<8 so ptr2-- {1,3,5,7(pr1),2,4,6(ptr2),
8}----------------> {1,3,5(ptr1),2,4,6(ptr2),7,8} moving on..........
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.