title: How can I create a QuickSort implementation in Swift?
body: <p>I'm learning swift and I've implemented varius sorting algorithms as ADT to practise. I'm just struggeling with quick sort which somehow won't work. Could someone tell me where the flaw in the code is? </p>
  
  <pre><code>func quickSort(start: Int, end: Int) {
      if (end &lt;= start) { return }
      let pivot = self.srtdArr[end]
      var left = start
      var right = end - 1
      while left &lt; right {
          while ((self.srtdArr[left] &lt;= pivot) &amp;&amp; (left &lt; end)) {
              left += 1
          }
          while ((self.srtdArr[right] &gt;= pivot) &amp;&amp; (right &gt; start)) {
              right -= 1
          }
          if left &lt; right { self.srtdArr.swapAt(left, right) }
      }
      self.srtdArr.swapAt(left, end)
      quickSort(start: start, end: right)
      quickSort(start: right+1, end: end)
      return
  }
  </code></pre>
  
  <p>Honestly I've varied the code to often to wrap my head around the problem properly anymore that's why I need fresh input. Whilst debugging I first noticed that sometimes the code got itself into a recursive loop. I changed some iterator or Boolean operator and now it determines, but not quit correctly and I don't know why.</p>