public static void main(String args[]) {
        int[] input = {2, 5, 3, 6, 4, 1, -1, 3, 4, 2};
        SparseTableRangeMinimumQuery sparseTableRangeMinimumQuery = new SparseTableRangeMinimumQuery(input);
        for (int i = 0; i < input.length; i++) {
            for (int j = i; j < input.length; j++) {
                System.out.print(sparseTableRangeMinimumQuery.rangeMinimumQuery(i, j) + " ");
            }
            System.out.println();
        }
    }
Date 04/28/2016
@author Tushar Roy

Find range minimum query using sparse table.

Preprocessing Time complexity O(nlogn)
Query Time complexity O(1)
Space complexity O(nlogn)

Reference -
https://www.topcoder.com/community/data-science/data-science-tutorials/range-minimum-query-and-lowest-common-ancestor/
src/com/interview/misc/SparseTableRangeMinimumQuery.java