From c910888f444615b63947d9aee726b901e64844e0 Mon Sep 17 00:00:00 2001 From: heimoshuiyu Date: Wed, 28 Apr 2021 23:16:45 +0800 Subject: [PATCH] week9 T8.c clang-format --- week9/T8.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/week9/T8.c b/week9/T8.c index 5ff3525..636f757 100644 --- a/week9/T8.c +++ b/week9/T8.c @@ -65,8 +65,10 @@ void QuickSort(int *A, int left, int right) { j = right - 1; while (1) { - while (A[++i] < pivot) {} - while (A[--j] > pivot) {} + while (A[++i] < pivot) { + } + while (A[--j] > pivot) { + } if (i >= j) { break; } @@ -74,13 +76,13 @@ void QuickSort(int *A, int left, int right) { } Swap(&A[i], &A[right - 1]); - QuickSort(A, left, i -1); + QuickSort(A, left, i - 1); QuickSort(A, i + 1, right); } int Median3(int *A, int left, int right) { int center = (left + right) / 2; - + if (A[left] > A[center]) { Swap(&A[left], &A[center]); } @@ -130,6 +132,6 @@ void Swap(int *a, int *b) { } void PrintTimeDuration(clock_t start_time, clock_t end_time) { - printf("Time cost: %ld ms\n", (end_time - start_time) / (CLOCKS_PER_SEC / 1000)); + printf("Time cost: %ld ms\n", + (end_time - start_time) / (CLOCKS_PER_SEC / 1000)); } -