I had my first round of interview today[phone interview] with a <reputed silicon firm>and i think it went well. So I'm sure the face-to-face interview is going to be more rigorous than this. Can you guys shoot a lot of <simple but hard> problems pertaining to C++ and Data Structures?<p>For example, i didn't know what a virtual function was, but I've used it before. So any tips on what to read up on is appreciated too.
On the phone interview:
Interviewer: How do you find if a linked list has a cycle?
Me:(feeling very confident) Use a set and every time a new element is traversed, write its pointer part into the set. Keep track of the number of nodes visited and size of the set. If/When they get unequal, you have found a loop!
Him: Er... use two pointers, one for the first element and the second for the next element. When both of their next elements are the same, its a loop.
Me: Oh...yeah. :|<p>So, you guys get the idea i hope. And yeah, wish me luck. :)
Thanks in advance.