MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / main

Function main

CPP/sorting/intro_sort.cpp:100–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100int main()
101{
102 int a[] = { 5, 7, -8, 9, 10, 4, -7, 0, -12, 1, 6, 2, 3, -4, -15, 12 };
103 int n = sizeof(a) / sizeof(a[0]);
104
105 // get the maximum depth
106 int maxdepth = log(n) * 2;
107
108 // sort the array using introsort the algorithm
109 introsort(a, a, a + n - 1, maxdepth);
110
111 // print the sorted array
112 for (int i = 0; i < n; i++) {
113 cout << a[i] << " ";
114 }
115
116 return 0;
117}

Callers

nothing calls this directly

Calls 1

introsortFunction · 0.85

Tested by

no test coverage detected