3 ms·
Binary search only works if you suppose the data is well structured. If you perform the search and in the meantime you spot a passing inconsistency, you can int
by Almondsetat 2y ago
Binary search only works if you suppose the data is well structured. If you perform the search and in the meantime you spot a passing inconsistency, you can interrupt everything and throw an error. But other than that, checking the entire structure negates the entire point of the algorithm