@@ -0,0 +1,1373 @@
+package org.psjava.example.algo;%0D%0A%0D%0Aimport org.junit.Assert;%0D%0Aimport org.junit.Test;%0D%0Aimport org.psjava.algo.sequence.rmq.RangeMinimumQueryBySquareRootApproach;%0D%0Aimport org.psjava.algo.sequence.rmq.RangeMinimumQueryResult;%0D%0Aimport org.psjava.algo.sequence.rmq.RangeMinimumQueryUsingSegmentTree;%0D%0Aimport org.psjava.algo.sequence.rmq.RangeMinimumQueryUsingSparseTable;%0D%0Aimport org.psjava.ds.array.Array;%0D%0Aimport org.psjava.ds.array.ArrayFromValues;%0D%0Aimport org.psjava.example.ds.ArrayExample;%0D%0Aimport org.psjava.goods.GoodRangeMinimumQuery;%0D%0Aimport org.psjava.util.DefaultComparator;%0D%0A%0D%0A/**%0D%0A * @implementation %7B@link RangeMinimumQueryBySquareRootApproach%7D%0D%0A * @implementation %7B@link RangeMinimumQueryUsingSegmentTree%7D%0D%0A * @implementation %7B@link RangeMinimumQueryUsingSparseTable%7D%0D%0A * @see %7B@link ArrayExample%7D%0D%0A */%0D%0Apublic class RangeMinimumQueryExample %7B%0D%0A%0D%0A%09@Test%0D%0A%09public void example() %7B%0D%0A%09%09Array%3CString%3E array = ArrayFromValues.create(%22A%22, %22E%22, %22B%22, %22C%22, %22G%22);%0D%0A%0D%0A%09%09RangeMinimumQueryResult result = GoodRangeMinimumQuery.getInstance().preprocess(array, new DefaultComparator%3CString%3E());%0D%0A%0D%0A%09%09int index1 = result.getIndex(1, 4); // must be 2, that is the index of %22B%22 among (%22E%22, %22B%22, %22C%22)%0D%0A%09%09Assert.assertEquals(2, index1);%0D%0A%0D%0A%09%09int index2 = result.getIndex(0, 3); // must be 0, that is the index of %22A%22 among (%22A%22, %22E%22, %22B%22)%0D%0A%09%09Assert.assertEquals(0, index2);%0D%0A%09%7D%0D%0A%7D%0D%0A

add RangeMinimumQueryExample