0 Replies - 296 Views - Last Post: 31 January 2015 - 08:48 PM

#1 brittishsnow  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 49
  • Joined: 11-October 13

[Swift] print issues?

Posted 31 January 2015 - 08:48 PM

Hi so I am not sure if any of you can help me, but my code won't print to the console output. No errors are given though

Here is the code

Thanks in advance
func quicksort_swift(inout a:[Int], start:Int, end:Int) {
    if (end - start < 2){
        return
    }
    var p = a[start + (end - start)/2]
    var l = start
    var r = end - 1
    while (l <= r){
        if (a[l] < p){
            l += 1
            continue
        }
        if (a[r] > p){
            r -= 1
            continue
        }
        var t = a[l]
        a[l] = a[r]
        a[r] = t
        l += 1
        r -= 1
    }
    quicksort_swift(&a, start, r + 1)
    quicksort_swift(&a, r + 1, end)
}
func main (){
    var numbers = [1,4,6,8,9,3,5,7,2]
    quicksort_swift(&numbers, 1, 9)
    println(numbers)
}


Is This A Good Question/Topic? 0
  • +

Page 1 of 1