Tìm các chỉ số nơi các yếu tố nên được chèn để duy trì trật tự.
Tìm các chỉ số thành một mảng được sắp xếp sao cho các phần tử tương ứng trong V được chèn trước các chỉ số, thứ tự của A sẽ được bảo tồn.
Giả sử rằng A được sắp xếp:
bên trái |
& nbsp; mã số 2:function is used to find the indices into a sorted array arr such that, if elements are inserted before the indices, the order of arr would be still preserved. Here, binary search is used to find the required insertion indices.
|