public void sort(int arr[]){
        Deque<Integer> stack = new LinkedList<Integer>();
        int l = 0;
        int h = arr.length-1;
        stack.offerFirst(l);
        stack.offerFirst(h);
        
        while(!stack.isEmpty()){
            h = stack.pollFirst();
            l = stack.pollFirst();
            
            int p = partition(arr,l,h);
            if(l < p-1 && h > p+1){
                stack.offerFirst(l);
                stack.offerFirst(p-1);
                stack.offerFirst(p+1);
                stack.offerFirst(h);
            }
            else if(l < p-1){
                stack.offerFirst(l);
                stack.offerFirst(p-1);
            }else if(h > p+1){
                stack.offerFirst(p+1);
                stack.offerFirst(h);
            }
        }
    }
http://www.geeksforgeeks.org/iterative-quick-sort/
Test case
0,1 or more elements in the array
src/com/interview/sort/IterativeQuickSort.java