summaryrefslogtreecommitdiff
path: root/wk3/lab/selection.c
diff options
context:
space:
mode:
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
+
+
+*/