Skip to content
Advertisement

Tag: binary-search-tree

Buggy simple function for binary search (C++)

I wrote a simple function for binary search, but it’s not working as expected. I have a vector with 4000000 32-bit ints. Usually, when I search for a number, if it’s there, it’s found and the index is returned, if it’s not, -1 is returned (the index always corresponds to the value, but that’s not the point). While messing around

Advertisement