Mostly 3 things interviewers expect from a candidate
- Can you visualize a large system and build its components.
- Can you logically optimize the system or its modules.
- Can you implement your logic within small time.
Most companies will hire you if you do well in 1 and 2, but do average in 3.
If you are a C++ programmer, learn the language fundamentals and how to effectively use the standard template library.
Learn in detail about pointers, classes, structs and object oriented programming concepts. Know how to create nodes that will be crucial for most problems. You should be able to create and traverse a linked list in about 5 minutes. learn how to approach expanding the data structure considering the inheritance properties.
Learn what the following are and how the related functions work. Understand and derive their time complexity.
- maps and sets (red-black Trees, AVL Trees)
- unordered_maps and unordered_sets (hash tables)
- vectors (dynamic arrays)
- Iterators (how to use them with the above data structures)
- Know how to represent a real world problem in the form of graphs.
The algorithm library is extremely important. Try to know all the functions, how they are internally implemented and their time/space complexity. They help save quite some of your interview time.
- In memory sort
- External sort
- reverse a statement, string
- Find nth_element
- optimize space usage
- mathematical functions
How to use the above knowledge:
A typical interview is about 45 minutes. You have to write a complete program and answer few logical programming questions within that time. Interviewers look for the robustness of your implementation and your design capabilities. Most interviewees fail to implement their logic within the required time, even though they know the logical design.
- Almost all the questions depend on your ability to use these data structures/algorithms directly, without implementing them – especially sort, vectors, maps.
- You may often need a data structure like hash table or heap to achieve a appreciable time complexity.
- First get the design in your mind and them start coding. Changing the design after coding half way is recipe for failure.
- Ask the interviewer for hint, if you are out of ideas. Interviewers appreciate if you pick up the hints and solve the problem faster.