diff --git a/scratchpad/quickselect/quickselect b/scratchpad/quickselect/quickselect index e3c99f2..ae25e1c 100755 Binary files a/scratchpad/quickselect/quickselect and b/scratchpad/quickselect/quickselect differ diff --git a/scratchpad/quickselect/quickselect.c b/scratchpad/quickselect/quickselect.c index c3607f9..4b72f6f 100644 --- a/scratchpad/quickselect/quickselect.c +++ b/scratchpad/quickselect/quickselect.c @@ -2,7 +2,83 @@ #include #include +void swap_pointers(double *x, double* y){ + double tmp = *x; + *x = *y; + *y = tmp; +} + +void swap_in_array(int i, int j, double xs[]){ + double tmp = xs[i]; + xs[i] = xs[j]; + xs[j] = tmp; +} + +void array_print(double xs[], int n){ + printf(" ["); + for(int i=0; i