#include #include #include #include #include #include using namespace std; #define swap(a,b) ((a)^=(b), (b)^=(a), (a)^=(b)) // prototypes void bsort(int array[], int size); void select(int array[], int size, int K, int &answer); // global cost variable extern int cost; // the notorious bubble sort void bsort(int array[], int size) { for (int i=size-1; i>0; i--) { for (int j=0; j array[j+1]) { swap(array[j], array[j+1]); } } } } // search the Kth smallest element void select(int array[], int size, int K, int &answer) { // FILL-IN }