home *** CD-ROM | disk | FTP | other *** search
- #include <LEDA/array.h>
-
-
- declare(array,int)
-
-
- main()
- {
-
- int N = read_int("N = ");
-
- array(int) A(N);
- array(int) B(N);
-
- int i;
-
- if (Yes("random ? "))
- for(i=0; i<N; i++) A[i] = B[i] = random(0,1000000);
- else
- for(i=0; i<N; i++) A[i] = B[i] = i;
-
- float T = used_time();
-
- (cout << "sorting with randomization ").flush();
- A.sort(compare,true);
- cout << string(" %6.2f sec\n",used_time(T));
- newline;
-
- (cout << "sorting without randomization ").flush();
- B.sort(compare,false);
- cout << string(" %6.2f sec\n",used_time(T));
- newline;
-
- if (Yes("Ausgabe ? "))
- for(i=0; i<N; i++) cout << string("%6d %6d\n",A[i],B[i]);
-
- }
-
-