Hacker News new | ask | show | jobs
by mtanski 5070 days ago
One of my favorite interview questions is do binary search when the function prototype is this:

int bsearch(int *values, size_t len, int term);

By the time we finish going through this exercise. I have a pretty good idea how they do with basic algorithms and indirection (pointers). In fact, pointers are a great way of testing a candidates ability to deal with indirection.

You can come up with simpler C pointer questions that also do not require tricks but this does the trick for me.

And yes, everybody gets binary search wrong, but that's okay. I learn a lot about a candidate when they are doing the exercise.