DEV Community

Discussion on: Quick Sort

Collapse
 
chenge profile image
chenge • Edited

Thanks, Linxea.

I have a better one in Ruby:

def qs a
  (pivot = a.pop) ? 
    qs(a.select{|i| i <= pivot}) + [pivot] + qs(a.select{|i| i > pivot}) :
    []
end
Collapse
 
annlin profile image
ann lin

omg what sourcery is this, looks like competitive programming