Set props.
3 * This file is a part of LEMON, a generic C++ optimization library
5 * Copyright (C) 2003-2006
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
21 #include <lemon/time_measure.h>
22 #include <lemon/smart_graph.h>
23 #include <lemon/graph_utils.h>
24 #include <lemon/maps.h>
25 #include <lemon/error.h>
27 #include <lemon/radix_sort.h>
34 using namespace lemon;
36 void testRadixSort() {
39 for (int i = 0; i < n; ++i) {
40 data[i] = (int)(1000 * (rand() / (RAND_MAX + 1.0))) - 500;
42 radixSort(data.begin(), data.end());
46 void testCounterSort() {
49 for (int i = 0; i < n; ++i) {
50 data[i] = (int)(1000 * (rand() / (RAND_MAX + 1.0))) - 500;
52 counterSort(data.begin(), data.end());
58 for (int i = 0; i < n; ++i) {
59 data[i] = (int)(1000 * (rand() / (RAND_MAX + 1.0))) - 500;
61 sort(data.begin(), data.end());
64 void testStableSort() {
67 for (int i = 0; i < n; ++i) {
68 data[i] = (int)(1000 * (rand() / (RAND_MAX + 1.0))) - 500;
70 stable_sort(data.begin(), data.end());
78 cout << "Radix sort: " << runningTimeTest(testRadixSort, 60) << endl;
79 cout << "Counter sort: " << runningTimeTest(testCounterSort, 60) << endl;
80 cout << "Standard sort: " << runningTimeTest(testSort, 60) << endl;
81 cout << "Stable sort: " << runningTimeTest(testStableSort, 60) << endl;