DEV Community

Discussion on: What's The Deal With Binary Search?

Collapse
 
jbristow profile image
Jon Bristow • Edited

And to those liberal arts coders who are still intimidated, please try to be kind to yourself.

I still have to break down binary search algorithms like this for a non-trivial amount of CS grads with various work histories.

Like, I don't expect you to retain the math that proves it, but it's one of the primary/simplest ways to search sorted data that's not brute force. About the only thing I'd expect more out of a CS degree person is to be able to tell me that the average access time is something to do with logarithms. officially: O(log n) Bonus if you remember that the average is also the worst case and that the best case is O(1).

I usually am not looking for you to remember that this is called a binary search. I don't like throwing terms out at people. Most of the time, I'll hand you a sorted list and ask if you can write me something that finds element X. If you give me the brute force (element 0, element 1, element 2) then I ask how you would make it faster. I'm usually looking for your thinking out loud process and whether you can stand my style of asking questions (and that I can stand your style of answering).

So... hopefully that helps people get over some of the trepidation of interviews. I know that there are some interviews that are super stressful, and some interview-ers that are looking for specific answers. But the people that you want to work for can tell the difference between quiet people and people who are legitimately out of their depth as well as people who know a lot and people who talk a lot. Try to just represent yourself as accurately and honestly as possible (while still trying to show yourself in the best possible light... you've got to be interested at least!).

Collapse
 
bengreenberg profile image
Ben Greenberg

Jon, these are very helpful reflections. Thank you!