Round Robin schedule (non-recursive), non-recursive round robin schedule
# Include <iostream> # include <vector> # include <iterator> # include <algorithm> using namespace std;/** round robin schedule (non-recursive) */void Copy (int ** map, int sr, int sl, int dr, int dl, int k) {for (int I = 0; I <k; I ++) {for (int j = 0; j <k; j ++) {map [dr + I] [dl + j] = map [sr + I] [sl + j] ;}} void Table (int ** map, int k) {for (int I = 2; I <= k; I <= 1) {for (int j = 0; j <k; j + = I) {// Copy from the upper left corner to the lower right corner (map, 0, j, 0 + I/2, j + I/2, I/2 ); // Copy (map, 0, j + I/2, 0 + I/2, j, I/2) from the upper right corner; }}} int main () {int k; // enter the number of athletes. cin> k; int ** p = new int * [k]; // The Competition table is initialized for (int I = 0; I <k; I ++) {p [I] = new int [k]; p [0] [I] = I + 1; p [I] [0] = I + 1;} // run the function Table (p, k); // output the result cout <"Round Robin schedule (non-recursive ): "<endl; for (int I = 0; I <k; I ++) {copy (p [I], p [I] + k, ostream_iterator <int> (cout, ""); cout <endl;} return 0 ;}