public void wiggleSort1(int[] nums) {
        boolean flag = true;
        for (int i = 0; i < nums.length - 1; i++) {
            if (flag) {
                if (nums[i] > nums[i + 1]) {
                    swap(nums, i, i + 1);
                }
            } else {
                if (nums[i] < nums[i + 1]) {
                    swap(nums, i, i + 1);
                }
            }
            flag = !flag;
        }
    }
Date 03/23/2016
@author Tushar Roy

Convert an unsorted array into an array of form num[0] < num[1] > nums[2] < num[3]....

Time complexity O(n) - This depends on KthElementInArray time
Space complexity O(1)

https://leetcode.com/problems/wiggle-sort/
https://leetcode.com/problems/wiggle-sort-ii/
src/com/interview/array/WiggleSort.java