Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

For things with non-trivial comparison functions you're all but certainly better off with those in something else like a hashmap. After all, the more expensive the compare, the more expensive the sort & reordering that a binary search requires. And then for trivial comparison objects, binary searching is still slower even at "huge" sizes like 10,000. It's really hard to find a good use of binary searching an array on modern CPUs.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: