赞
踩
void quickSort(int *nums, int left, int right) { if (left > right) return; int low = left; int high = right; int base = nums[left]; while (low < high) { while (nums[high] >= base && low < high) { high--; } nums[low] = nums[high]; while (nums[low] <= base && low < high) { low++; } nums[high] = nums[low]; } nums[low] = base; quickSort(nums, left, low-1); quickSort(nums, high+1, right); }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。