object Solution { def getPivot(a: Array[Int], low: Int, high: Int): Int = { var pivot = low var l = low var h = high /*println("In getPivot() low: " + low + " high: " + high) for(i <- l to h){ print(a(i) + " ") } println()*/ while(l < h){ while(a(pivot) >= a(l) && l < high){ l = l + 1 } while(a(pivot) < a(h) && h > low){ h = h - 1 } if(l < h){ var temp = a(l) a(l) = a(h) a(h) = temp } } //println("low: " + l + " high: " + h) var temp = a(pivot) a(pivot) = a(h) a(h) = temp /*a.foreach(i => print(i + " ")) println() */ h } def quickSort(arr: Array[Int], low: Int, high: Int): Array[Int]={ if(low print(i + " ")) //println() } }