邏輯Logic iOS Swift底層進(jìn)階班
? ?for (int i = start; i < end; i++) {
? ? ? ? ? ?if (nums[i] <= pivotValue) {
? ? ? ? ? ? ? ?j++;
? ? ? ? ? ? ? ?if (i != j) {
? ? ? ? ? ? ? ? ? ?swap(nums, i, j);
? ? ? ? ? ? ? ?}
? ? ? ? ? ?}
? ? ? ?}
? ? ? ?swap(nums, j + 1, end);
? ? ? ?return j + 1;
? ?}
? ?private void swap(int[] nums, int i, int j) {
? ? ? ?int temp = nums[i];
? ? ? ?nums[i] = nums[j];
? ? ? ?nums[j] = temp;
標(biāo)簽: