Login Register


C++ Binary Search filter_list
Author
Message
C++ Binary Search #1
A binary search is a method of searching for some data in a specific way, you can see it in action here:
[Image: binary-and-linear-search-animations.gif]

I done this for my cousin's computer science work when he got stuck a while back, so it's not that good, but it works!

https://mega.nz/#!VMUlQYwa!YInljZQC-nHnS...Aszb3ILlL0

Please note, the color on the text is an external library I can't seem to find, if requested I will find it.

Reply

RE: C++ Binary Search #2
This is far from "working". It actually won't even compile regardless of the console colors header file not existing.
Code:
while (higher = true) { Mid cout << green << "Mid is " << Mid; }

What is 'Mid' doing in there? And aside from attempting to compare a boolean with true, you're actually assigning it true and thus the loop is syntactically synonymous with 'while(true)'

This also isn't a proper binary search because it doesn't continue with the search properly.

Reply







Users browsing this thread: