Most Important Concepts in C and C++ That Should Be Learnt and Understood Before A Programming Interview - Quora
Most Important Concepts in C and C++ That Should Be Learnt and Understood Before A Programming Interview - Quora
Data Structures
You should know how to use all these + all their related functions + the time
complexity of all these functions + (probably) how these functions work
vectors (dynamic arrays) - know why push_back is amortized constant, not
just that it is so
stacks/queues/deques/lists
You should also know what iterators are and how to use them with the above data
structures and below algorithms, because you need to when using STL.
Graphs are also important to know how to implement. For interviews, I usually use a
vector of vectors for an adjacency-list (or even adjacency-matrix) representation just
because it's fast to implement and usually is sucient enough for you to write your
algorithm, but alternatives are also feasible and some people may prefer building it
from scratch using classes/structs/pointers. In many cases you can just forgo building
the graph completely during an interview and assume you have it given, and in some
cases you shouldn't build the graph at all, but rather have your algorithm dynamically
generate the needed parts as it executes.
Algorithms
Aside from all the related functions for the data structures above, the algorithm
library is extremely important, and you should probably know every function in it as
well as how it's implemented and its time/space complexity (because all of these are
fair game for interview questions and you might be asked to implement them from
scratch, though probably without as much generalization as STL). Here are the most
important ones, though, in my opinion:
sort
stable_sort
nth_element
Upvoted 167 Downvote Comments 6+
https://www.quora.com/What-are-the-most-important-concepts-in-C-and-C++-that-should-be-learnt-and-understood-before-a-progra 1/3
2017-5-31 Jimmy Saade's answer to What are the most important concepts in C and C++ that should be learnt and understood before a
lower_bound
Ask or Search Quora Ask Question Read Answer Notifications Deepanshu
upper_bound
merge/inplace_merge
next_permutation/prev_permutation
rotate
reverse
Familiarizing yourself with the various math functions via the cmath library is
probably also a good idea, just in case you need them, though if you need a tan
function in an interview you can probably just tell your interviewer "I'm going to
assume I have a function to calculate tan(x)" and it'd be ne.
The theory version of this question is answered here: Jimmy Saade's answer to What
should I know from CLRS 3rd edition book if my aim is to get into Google? and so they
kind of go together in that what's listed in this answer is an implementation of the
concepts listed in the other.
Answer Timeline
Jimmy Saade
software engineer at Facebook
Answered Jul 1, 2015
Following 2.1k
https://www.quora.com/What-are-the-most-important-concepts-in-C-and-C++-that-should-be-learnt-and-understood-before-a-progra 2/3