Question: how to find kth smallest element?
Answer: Partition the array A[left .. right] into two subarrays A[left .. ... 
Computes the number of elements in the subarray A[left .. ... 
if (count == K), then A[pos] is the Kth smallest element.
Otherwise determines in which of the two subarrays A[left ..