File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < stdio.h>
2
+ #include < stdint.h>
3
+ #include < time.h>
4
+
5
+ #include " generic.h"
6
+ #include " radix_sort.h"
7
+
8
+ int main ()
9
+ {
10
+ using namespace alg ;
11
+ const int MAX_ELEMENTS = 10 ;
12
+ uint32_t list[MAX_ELEMENTS];
13
+
14
+ int i = 0 ;
15
+ srand (time (NULL ));
16
+ // generate random numbers and fill them to the list
17
+ for (i = 0 ; i < MAX_ELEMENTS; i++ ){
18
+ list[i] = rand ()%100 ;
19
+ }
20
+
21
+ printf (" The list before sorting is:\n " );
22
+ printlist (list,MAX_ELEMENTS);
23
+
24
+ // sort the list using insertion sort
25
+ radix_sort (list, MAX_ELEMENTS);
26
+ check_order (list, MAX_ELEMENTS);
27
+
28
+ // print the result
29
+ printf (" The list after sorting using radix sort algorithm:\n " );
30
+ printlist (list,MAX_ELEMENTS);
31
+
32
+ return 0 ;
33
+ }
You can’t perform that action at this time.
0 commit comments