When interviewing for a programmer position, how can I be very thoroughly prepared for the technical interview (writing code on a board)? I'm asking specifically about interviews at companies(like Google) that tend to ask more algorithm design questions, algorithms that aren't in all college courses or textbooks and are used very often in daily programming. It seems that just doing a lot of programming doesn't do much to improve one's chances at the technical interview because the questions usually aren't something you're likely to encounter so what are some ways to be well prepared for these?
Examples of questions are to write code to: serialize/deserialize a tree, verify if a given node is valid in a binary search tree by climbing up the tree (rather than the other direction which can be done with a normal search), or find the maximum subarray. Usually the interviewer is looking for the most efficient answer and relatively quickly.
I did look at the book "Programming Interviews Exposed" but it doesn't seem to have that many sample questions and they aren't difficult enough.
Do you have any suggestions how to be very well prepared for these algorithm design type questions?