Open adcgx opened 6 years ago
int expected = ceil(log2(nodecount)) - nodecount;
This is always negative and will result in the next loop never executing. Also, at the end, the root node needs to be left-rotated 1 extra time.
Thanks for the note. I plan to rewrite the tutorial for this algorithm and port the code over to C++.
Won't doing int expected = floor(log2(nodecount)) - nodecount; solve this problem? Or I'm thinking wrong.
int expected = floor(log2(nodecount)) - nodecount;
int expected = ceil(log2(nodecount)) - nodecount;
This is always negative and will result in the next loop never executing. Also, at the end, the root node needs to be left-rotated 1 extra time.