posted 19 years ago
Actually, I guess a more efficient way to do it would be since the first array is by definition sorted, you could create the second array, and copy the elements from the first array into it as long as the elements are "less than" what you want to add. When you get to the first element in the original array that is "greater than" what you want to add, then add your element to the new array, and then copy the remainder from the original array into the new one.