How to prepare for Programming Interviews . . .

How to prepare for Programming Interviews . . .

Mostly 3 things interviewers expect from a candidate

  1. Can you visualize a large system and build its components.
  2. Can you logically optimize the system or its modules.
  3. 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.

screen-shot-2014-12-04-at-12-04-42-am

 

If you are a C++ programmer, learn the language fundamentals and how to effectively use the standard template library.

Language Fundamentals:

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.

Data Structures:

Learn what the following are and how the related functions work. Understand and derive their time complexity.

  • stacks/queues/deques/lists
  • maps and sets (red-black Trees, AVL Trees)
  • unordered_maps and unordered_sets (hash tables)
  • vectors (dynamic arrays)
  • priority_queues
  • Iterators (how to use them with the above data structures)
  • Know how to represent a real world problem in the form of graphs.
  • Tries

Algorithms:

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
  • lower_bound,upper_bound
  • next_permutation/prev_permutation
  • rotate
  • 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.

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *