From 33d44300b2ca4ee47d5ea23397589a0b940ab590 Mon Sep 17 00:00:00 2001 From: AnushkaBhardwaj15 Date: Fri, 30 Jan 2026 16:56:13 +0530 Subject: [PATCH 1/3] improved readability in selection sort swap --- sorting/selection_sort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorting/selection_sort.c b/sorting/selection_sort.c index c7547608c7..90f7b49029 100644 --- a/sorting/selection_sort.c +++ b/sorting/selection_sort.c @@ -39,7 +39,7 @@ void selectionSort(int *arr, int size) } if (min_index != i) { - swap(arr + i, arr + min_index); + swap(&arr[i], &arr[min_index]); } } } From 3f913779a8d9df740d459ba69f00c75d15051064 Mon Sep 17 00:00:00 2001 From: AnushkaBhardwaj15 Date: Mon, 9 Feb 2026 19:36:27 +0530 Subject: [PATCH 2/3] Fixed Formatting and Comment --- sorting/selection_sort.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sorting/selection_sort.c b/sorting/selection_sort.c index 90f7b49029..4c2d43336f 100644 --- a/sorting/selection_sort.c +++ b/sorting/selection_sort.c @@ -9,7 +9,8 @@ #include /** - * Swapped two numbers using pointer + * Swap two integers using pointer + * * @param first first pointer of first number * @param second second pointer of second number */ From 7f193302c16ca83a213d0692820e5c932371ec4c Mon Sep 17 00:00:00 2001 From: AnushkaBhardwaj15 Date: Thu, 19 Feb 2026 00:10:33 +0530 Subject: [PATCH 3/3] docs: improved selection sort function documentation --- sorting/selection_sort.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sorting/selection_sort.c b/sorting/selection_sort.c index 4c2d43336f..17ecae9fdb 100644 --- a/sorting/selection_sort.c +++ b/sorting/selection_sort.c @@ -22,9 +22,12 @@ void swap(int *first, int *second) } /** - * Selection sort algorithm implements + * Implements the Selection Sort algorithm. + * * @param arr array to be sorted - * @param size size of array + * @param n NUmber of elements in the array + * Time Complexity:0(n^2) + * Space Complexity: O(1) */ void selectionSort(int *arr, int size) {