function w = qsort(v)
    if length(v) <= 1
        w = v;
    else
        x     = v(1); 
        vRest = v(2:end);
        Lg    = vRest(vRest >= x); 
        Sm    = vRest(vRest <  x); 
        
        w = [qsort(Sm), x, qsort(Lg)];
    end
    
end