GRB-Dynamics / SimpleBST

A simple demonstration of a binary search tree.
1 stars 0 forks source link

DSW algorithm is wrong #1

Open adcgx opened 6 years ago

adcgx commented 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.

Ramlall commented 6 years ago

Thanks for the note. I plan to rewrite the tutorial for this algorithm and port the code over to C++.

MichaelStett commented 5 years ago

Won't doing int expected = floor(log2(nodecount)) - nodecount; solve this problem? Or I'm thinking wrong.