### Question:
SelectIndexDataActivity extends BaseActivity { public static int randomizedSelect(int[] a, int p, int r, int i) { if (p == r) { return a[p]; } int q = randomizedPartition(a, p, r); int k = q - p + 1; if (i == k) { return a[q]; } else if (i < k) { return randomizedSelect(a, p, q - 1, i); } else { return randomizedSelect(a, q + 1, r, i - k); } }  static int partition(int[] a, int p, int r); static int randomizedSelect(int[] a, int p, int r, int i);  }### Answer:
@Test public void testSort() throws Exception { int a[]={2,5,3,0,2,3,0,3}; int result= selectIndexDataActivity.randomizedSelect(a,0,a.length-1,3); System.out.println("快速选择算法求出的,第"+3+"个最小数是："+result); assertEquals(2,result); }