by asdguinui · 3y ago · 0 comments
https://stackoverflow.com/questions/65753731/why-searching-a...
Hardly clean, I think you'd agree.
In any case, you shouldn't use explicit iteration to solve this problem without a good reason. Every language should have both linear and binary search as part of its standard library.
I agree that you shouldn't especially choose one algorithm over another without reason and I feel comfortable choosing a linear scan of short sections of cached data in pipelined situations where branching overheads are steep.
Was the case in the TV episode such a scenario? I have no knowledge of that myself.
Vouched.