function quickSort(arr) {
// Complete this function
var left = [], right = [], equal = [];
var p = arr[0];
for(i = 1;i< arr.length ; i++)
{
if(arr[i] <= p)
{
left = left.push(arr[i]);
}
else if(arr[i] > p)
{
right = right.push(arr[i]);
}
}
return left.concat(equal).concat(right);
}
console.log(quickSort([2,1,3,1,2]));