app/js/controllers.js
/*
     Summary: Internal function for quickSort. Finds the ideal location to partition a collection into two parts then
        checks to see that all items to the left of the partition are less than the partition and all numbers to the
        right are greater than the partition. This is the bread and butter of quick sort.
     Parameters:
        items: the collection of items being sorted
        left: the current left index
        right: the current right index
     Returns: the index of the ideal partition location relative to the items collection
     */
Internal function for quickSort. Finds the ideal location to partition a collection into two parts then
checks to see that all items to the left of the partition are less than the partition and all numbers to the
right are greater than the partition. This is the bread and butter of quick sort.
Internal function for quickSort . Finds the ideal location to partition a collection into two parts then checks to see that all items to the left of the partition are less than the partition and all numbers to the right are greater than the partition . This is the bread and butter of quick sort .
function partition(items, left, right) {
        var pivot   = items[Math.floor((right + left) / 2)],
            i       = left,
            j       = right;
        while (i <= j) {
            while (items[i].startPoint < pivot.startPoint) {
                i++;
            }
            while (items[j].startPoint > pivot.startPoint) {
                j--;
            }
            if (i <= j) {
                swap(items, i, j);
                i++;
                j--;
            }
        }
        return i;
    }
function partition ( items , left , right ) { var pivot = items [ Math . floor ( ( right + left ) / 2 ) ] , i = left , j = right ; while ( i <= j ) { while ( items [ i ] . startPoint < pivot . startPoint ) { i ++ ; } while ( items [ j ] . startPoint > pivot . startPoint ) { j -- ; } if ( i <= j ) { swap ( items , i , j ) ; i ++ ; j -- ; } } return i ; }
Summary: Internal function for quickSort.
Summary : Internal function for quickSort .