Use the merge algorithm to find the third step of the merge of A and B. Here are the first two steps:
Initial State | A = [2,4,9] | B = [1,7,13,15] | Results = [ ] |
First Step | A = [2,4,9] | B = [7,13,15] | Results = [1] |
Second Step | A =[4,9] | B = [7,13,15] | Results = [1,2] |
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
For the third step, you compare the smallest of the first (smallest) elements of A and B, and move this element over to Results. In this case, the smaller value is 4 (in element A), which gets moved to the end of Results.
So, you wind up with A = [ 9 ] , B = [ 7 , 1 3 , 1 5 ] , Results = [ 1 , 2 , 4 ]