function binaryInsertionSort(array) {
    let arr = array.slice(0);
    for (let index = 1; index < arr.length; index++) {
        const insertionIndex = binaryFindIndex(arr, index, arr[index]);
        arr = insertAtIndex(arr, insertionIndex, index);
    }
    return arr;
}
//binaryInsertionSort function takes an array and sort it using binary search to find the next index. 
binaryInsertionSort function takes an array and sort it using binary search to find the next index.
binaryInsertionSort function takes an array and sort it using binary search to find the next index .
function binaryInsertionSort(array) {
    let arr = array.slice(0);
    for (let index = 1; index < arr.length; index++) {
        const insertionIndex = binaryFindIndex(arr, index, arr[index]);
        arr = insertAtIndex(arr, insertionIndex, index);
    }
    return arr;
}
function binaryInsertionSort ( array ) { let arr = array . slice ( 0 ) ; for ( let index = 1 ; index < arr . length ; index ++ ) { const insertionIndex = binaryFindIndex ( arr , index , arr [ index ] ) ; arr = insertAtIndex ( arr , insertionIndex , index ) ; } return arr ; }
binaryInsertionSort function takes an array and sort it using binary search to find the next index.
binaryInsertionSort function takes an array and sort it using binary search to find the next index .