title: Possible to do quicksort without splitting into separate lists?
body: <p>In many quicksort algorithms, the programming involves placing the elements from each array into three groups:(<code>less</code>, <code>pivot</code>, <code>more</code>), and sometimes placing the groups back together. What if I do not want to use this? Is there a simpler approach to sorting a list with quicksort manually?</p>
  
  <p>Basically, I plan to keep the array as one, and swap all the elements based on a partition (for example, given a list <code>x</code> and pivot <code>r</code>, we could have the reference lists of <code>[0:r]</code> and <code>[r:len(x)]</code>. However, as the sorting continues, how do I continue referencing each smaller "subarray"?</p>
  
  <p>So this is my code, but I'm not sure how to continue from here:</p>
  
  <pre><code>x = [4,7,4,2,4,6,5]
  #r is pivot POSITION
  r = len(x)-1
  i = -1
  for a in range(0,r+1):
      if x[a] &lt;= x[r]:
          i+=1
          x[i], x[a] = x[a], x[i]
  </code></pre>