MCPcopy Create free account
hub / github.com/albertobsd/keyhunt / bsgs_introsort

Function bsgs_introsort

bsgsd.cpp:1456–1473  ·  view source on GitHub ↗

OK */

Source from the content-addressed store, hash-verified

1454
1455/* OK */
1456void bsgs_introsort(struct bsgs_xvalue *arr,uint32_t depthLimit, int64_t n) {
1457 int64_t p;
1458 if(n > 1) {
1459 if(n <= 16) {
1460 bsgs_insertionsort(arr,n);
1461 }
1462 else {
1463 if(depthLimit == 0) {
1464 bsgs_myheapsort(arr,n);
1465 }
1466 else {
1467 p = bsgs_partition(arr,n);
1468 if(p > 0) bsgs_introsort(arr , depthLimit-1 , p);
1469 if(p < n) bsgs_introsort(&arr[p+1],depthLimit-1,n-(p+1));
1470 }
1471 }
1472 }
1473}
1474
1475/* OK */
1476void bsgs_insertionsort(struct bsgs_xvalue *arr, int64_t n) {

Callers 1

bsgs_sortFunction · 0.70

Calls 3

bsgs_insertionsortFunction · 0.70
bsgs_myheapsortFunction · 0.70
bsgs_partitionFunction · 0.70

Tested by

no test coverage detected