Department of Computer Science | Institute of Theoretical Computer Science | CADMO

Theory of Combinatorial Algorithms

Prof. Emo Welzl and Prof. Bernd Gärtner

// Program: sort_array2.C // read a sequence of n numbers into an array, // sort them using a function, and output the // sorted sequence #include // PRE: [first, last) is a valid range // POST: the elements *p, p in [first, last) are // in ascending order void sort (int* first, int* last) { // insert your sorting code here } int main() { // input of n unsigned int n; std::cin >> n; // dynamically allocate array int* a = new int[n]; // read into the array for (int i=0; i> a[i]; // sort sort (a, a+n); // output sorted sequence for (int i=0; i