timsort.js
/**
 * Merges all runs on the stack until only one remains.  This method is
 * called once, to complete the sort.
 * @param {TimSort} tim 
 */
Merges all runs on the stack until only one remains.  This method is
called once, to complete the sort.
Merges all runs on the stack until only one remains . This method is called once to complete the sort .
function mergeForceCollapse(tim){
    let runLen = tim.runLen;
    while (tim.stackSize > 1) {
        let n = tim.stackSize - 2;
        if (n > 0 && runLen[n - 1] < runLen[n + 1]){
            n--;
        }
        mergeAt(tim, n);
    }
}
function mergeForceCollapse ( tim ) { let runLen = tim . runLen ; while ( tim . stackSize > 1 ) { let n = tim . stackSize - 2 ; if ( n > 0 && runLen [ n - 1 ] < runLen [ n + 1 ] ) { n -- ; } mergeAt ( tim , n ) ; } }
Merges all runs on the stack until only one remains.
Merges all runs on the stack until only one remains .