Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Deepankar Umare

Guide on Placements

To get started, do a Coursera/ Udacity Course on Data Structure and Algorithms.

Practice STL data structures like Vector, Map, Set, Stack, Queue, Priority Queue, Pair, String
and its functions lower_bound, sort, upper_bound, binary_search, etc.
http://www.cplusplus.com/ and other websites.
Know how they work and where can they be used.

To get a hold on coding, start with A2oJ ladders. Complete at least one ladder
https://www.a2oj.com/Ladders.html
(keep doing this later to get idea of your coding speed and mistakes)

Then start with DS main page https://www.geeksforgeeks.org/data-structures/ (MUST DO


FIRST. )

Important: Don’t rely on GFG code. It’s not good for Placements. Especially Graphs. You can
write better codes. Refer to websites like Electrode how codes are written.

For Graphs(and other algorithms) Refer http://cp-algorithms.com/ [ A very high quality and
awesome codes ]

Remember, for placements you should write a consistent, short code comfortable to you.
Consistent because you might need to use same function for e.g. Merge function of merge sort,
or modify your BFS algorithm multiple times. If you use such consistent codes (i.e. you should
use proper variables every time, similar style), it would be easy to debug. If you write BFS
code differently every time, it will cause trouble. So, make sure you maintain a proper
directory of codes and snippets of functions and subroutines (like GCD, BFS, Quick Sort, DFS,
findCycleUndirectedGraph, etc) you’ve written.

Don’t go for advanced DS like segment tree or BIT early on.


Know all fundamental sorting algorithms (Selection, Insertion, Merge, Quick, Heap, Radix),
Search algorithms very well.

Then proceed to https://www.geeksforgeeks.org/fundamentals-of-algorithms/


Greedy, DP (all 50 important), Divide and Conquer, Backtracking and Graph Algorithms.
Again, look for good codes. GFG codes are very poorly written, graphs in particular.

Always look for time and space complexity. Just coding wont suffice, coding optimally is
important.
You must be able to estimate complexity of your approach instantly by experience (for e.g.,
Divide and conquer--> logn term)
Tip: Even time complexity requirement can eliminate various approaches you might go
otherwise. For instance, if nlogn algorithm is required (like if size of n is 105 ), then n2 DP
won’t work, etc.

String algorithms can be done later.

For Classical Problems:

Then start practicing from leetcode and interviewbit. [Very important]


(If you finish IB and most of leetcode) you can solve all the questions in placements easily.

Leetcode.
You’ll get hold on every topic, every algorithm here.
Start from easy, and top 100. Then you can go to medium and topicwise.

Important: Leetcode codes are of excellent quality, perfect for CP and placements.
Always view solutions with all the approaches and SEE THE DISCUSSION AND
DIFFERENT CODES OF GEEKS. This is extremely useful. Learning from others will speed
up your learning and improve it too.

IB is also very important. It will give you strong grip on almost all important topics.

For Non Classical Problems:

Codeforces [excellent]( https://codeforces.com/problemset)


 Click on a topic to get problems of that topic

CodeMonk (https://www.hackerearth.com/practice/codemonk/)

I practiced mostly from Leetcode and CodeMonk, its really good to test you topicwise coding
skills

Other awesome resources (do if you get time): Spoj, hackerrank and Hackerearth.

 Links

https://www.geeksforgeeks.org/common-mistakes-avoided-competitive-programming-c-
beginners/

http://mdotsabouri.blogspot.com/2014/10/my-recipe-to-improve-your-programming.html

https://www.geeksforgeeks.org/tips-and-tricks-for-competitive-programmers-set-1-for-
beginners/

https://algs4.cs.princeton.edu/cheatsheet/

https://codeforces.com/blog/entry/64218

https://www.geeksforgeeks.org/writing-cc-code-efficiently-in-competitive-programming/

 Sample template:

1. #include <bits/stdc++.h>
2.
3. #define pb push_back
4. #define pii pair<int,int>
5. #define vi vector<int>
6. #define vii vector<pii>
7. #define mi map<int,int>
8. #define mii map<pii,int>
9. #define all(a) (a).begin(),(a).end()
10. #define x first
11. #define y second
12. #define sz(x) (int)x.size()
13. #define endl '\n'
14. #define hell 100000000000000007LL
15. #define rep(i,a,b) for(int i=a;i<b;i++)
16.
17. using namespace std;

Later:

 String Algorithms

1. Trie
2. Segment Tree
3. Binary Indexed Tree(BIT)
4. Bitmasking
5. Bit manipulation

 Seive
 NcR effiecient
 Difference array

Training(optional)
https://docs.google.com/spreadsheets/d/1iJZWP2nS_OB3kCTjq8L6TrJJ4o-5lhxDOyTaocSYc-
k/edit#gid=1560625140

You might also like