summaryrefslogtreecommitdiff
path: root/wk3/lab/selection.c
diff options
context:
space:
mode:
authorFudgerboy <91767657+Fudgerboy@users.noreply.github.com>2024-02-17 23:27:18 +0000
committerFudgerboy <91767657+Fudgerboy@users.noreply.github.com>2024-02-17 23:27:18 +0000
commit71d4187657bd06f03a6111f66e9f2dd4ec7d1712 (patch)
tree2fa5d9da6a23e74e567105da3aab0686b9d656ae /wk3/lab/selection.c
parentccd3788a09c430542ab192d645351956c745007c (diff)
Sat, Feb 17, 2024, 3:27 PM -08:00
Diffstat (limited to 'wk3/lab/selection.c')
-rw-r--r--wk3/lab/selection.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/wk3/lab/selection.c b/wk3/lab/selection.c
index 056eaaf..93e1cc7 100644
--- a/wk3/lab/selection.c
+++ b/wk3/lab/selection.c
@@ -5,5 +5,28 @@
#include <string.h>
int main(void) {
-
+ int arr[] =
+ for (int i = 0; i < arr.length - 1; i++) {
+ int n;
+ int m;
+ for (int j = i; j < arr.length - 1; j++) {
+ if (arr[j] < n || n === undefined) {
+ n = arr[j];
+ m = j;
+ }
+ }
+ int k = arr[i];
+ arr[i] = n;
+ arr[m] = k;
+ }
}
+
+
+/*
+ grab the first value and record it
+ go throught each value and record the smallest
+ swap the 1st value and the smallest value
+ repeat
+
+
+*/