---
# System prepended metadata

title: Untitled

---


let array = [3,2,4,1];

// quickSort
// select pivot randomnly 
// [4]

function sort(array){
    let sortedArray = [];
    let min = null;
    
    while(array.length){
        for(let i=0; i< array.length; i++){
            if(min === null){
                min = array[i];
            } else {
                if(array[i] < min){
                    min = array[i]
                }
            }
        }

        removeFromArray(index);

        sortedArray.push(min);
    }
    
}
