Merge Sorted Array

写了两段code,但他们原理相同。注意这里i可以由indexA + indexB + 1的值代替。make code more concise

Merge Two Sorted Arrays

challenge:How to optimize when one array is very large and the other is very small?

1.use binary search to find a place to insert the elments in the small array

  1. use System.arrayucopyto method to copy the subarray in large array, this method may be more efficient than normal assignment.

results matching ""

    No results matching ""