News for hackers. Stuff that matters.
Re:Optimizations on Linear Search (2016) by CyberDildonics on Saturday October 03, 2020 @05:49PM (#24674926)
It is pretty easy, I would expect that at least some people would be able to do it. MIN_INTEGER was an example, it should be obvious you want the minimum for whatever type you are using. Standard C++ has std::numeric_limits<T>::lowest
Re:Optimizations on Linear Search (2016) by lixtra on Saturday October 03, 2020 @06:45PM (#24675233)
Standard C++ also has std::max_element [1] (and accidentally the possible implementation looks surprisingly familiar). Not that I know much of C++.

[1] https://en.cppreference.com/w/cpp/algorithm/max_element

Re:Optimizations on Linear Search (2016) by CyberDildonics on Sunday October 04, 2020 @11:22AM (#24679668)
That returns an iterator the max element, not the value. I'm not sure which part makes this so difficult that everyone fails on the first try.