Here you can find the source of quickSortStringArray(String array[], int lo0, int hi0)
Parameter | Description |
---|---|
array | The array to sort. |
lo0 | The low bound of the chunk of the array to sort. |
hi0 | The high bound of the array to sort. |
static void quickSortStringArray(String array[], int lo0, int hi0)
//package com.java2s; public class Main { /**/*from w w w . j a va 2s . c o m*/ * Quick sort the given chunk of the array in place. * @param array The array to sort. * @param lo0 The low bound of the chunk of the array to sort. * @param hi0 The high bound of the array to sort. */ static void quickSortStringArray(String array[], int lo0, int hi0) { int lo = lo0; int hi = hi0; String mid = null; if (hi0 > lo0) { mid = array[(lo0 + hi0) / 2]; while (lo <= hi) { while ((lo < hi0) && (array[lo].compareTo(mid) < 0)) ++lo; while ((hi > lo0) && (array[hi].compareTo(mid) > 0)) --hi; if (lo <= hi) { String tmp = array[lo]; array[lo] = array[hi]; array[hi] = tmp; ++lo; --hi; } } if (lo0 < hi) quickSortStringArray(array, lo0, hi); if (lo < hi0) quickSortStringArray(array, lo, hi0); } } }