Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Merging A and B
- left = right = counter = 0
- i = 0
- while left < length(A) && right < length(B)
- if A[left] > B[right]:
- C[counter] = B[right]
- counter = counter + 1
- right = right + 1
- end if
- else:
- C[counter] = B[right]
- counter = counter + 1
- right = right + 1
- end else
- end for
- if left < length(A)
- while left < length(A)
- C[counter] = A[left]
- left = left + 1
- counter = counter + 1
- end while
- end if
- if right < length(B)
- while right < length(B)
- C[counter] = B[right]
- right = right + 1
- counter = counter + 1
- end while
- end if
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement