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

Function bsgs_heapify

bsgsd.cpp:1523–1535  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1521}
1522
1523void bsgs_heapify(struct bsgs_xvalue *arr, int64_t n, int64_t i) {
1524 int64_t largest = i;
1525 int64_t l = 2 * i + 1;
1526 int64_t r = 2 * i + 2;
1527 if (l < n && memcmp(arr[l].value,arr[largest].value,BSGS_XVALUE_RAM) > 0)
1528 largest = l;
1529 if (r < n && memcmp(arr[r].value,arr[largest].value,BSGS_XVALUE_RAM) > 0)
1530 largest = r;
1531 if (largest != i) {
1532 bsgs_swap(&arr[i],&arr[largest]);
1533 bsgs_heapify(arr, n, largest);
1534 }
1535}
1536
1537void bsgs_myheapsort(struct bsgs_xvalue *arr, int64_t n) {
1538 int64_t i;

Callers 1

bsgs_myheapsortFunction · 0.70

Calls 1

bsgs_swapFunction · 0.70

Tested by

no test coverage detected