Interview Preparation Plan For Fresher
Interview Preparation Plan For Fresher
Day 0: Stick to a programming language like C or C++. Make sure that you
are comfortable with pointers/objects.
Day 1: Understand the concept of Algorithmic complexity. Skip the theory
for now, but for every piece of code you write, you should be able to derive
both time and space complexity.
1. Arrays
2. Linked Lists
3. Strings
4. Stacks
5. Queues
Understand their basic operations (insert, delete, and search, traversal) and
their complexity - Big-O Algorithm Complexity Cheat Sheet, and code them all.
1. Sorting - Insertion sort, Merge sort, Quick sort, Heap sort, Bucket
sort, Counting sort, Radix sort, External sorting
2. Search - Linear search, Binary Search (along with its variants).
3. Prime Numbers - Sieve of Eratosthenes, Primality test
4. Strings - String searching, LCS, Palindrome detection
5. Miscellaneous - Euclidean algorithm, Matrix multiplication, Fibonacci
Numbers, Pascal's Triangle, Max Subarray problem
Day 26 - 50: Once you are comfortable with everything above, start doing
problems from,
1. Tree
a. Binary Tree, Binary Search Tree - Tree traversals, Lowest
common ancestor, Depth, Height & Diameter, Finding k-th
smallest element
b. Heaps
2. Hash table - 4 sum problem, Checking if sudoku solution is valid
3. Graph - Breadth-first search, Depth-first search, Topological
sorting, Minimum spanning tree, Shortest path problem,
Day 61- 90: Refer to the previous resources and start doing problems from
trees, hash tables, heaps and graphs.
Day 91 - 100: Understand Computational complexity theory and NP-
completeness, Knapsack problem, Travelling salesman problem, SAT
problem and so on.
Day 101 - ∞∞: You are now better than most of the CS undergrads. Keep
revising the above topics and start competitive programming! Good luck!
https://www.appliedaicourse.com/blog/a-star-algorithm-in-ai/
https://medium.com/@sachin28/the-algorithms-behind-the-working-of-google-maps-73c379bcc9b9
https://medium.com/@sachin28/the-algorithms-behind-the-working-of-google-maps-73c379bcc9b9
Bubble Sort
Merge Sort
Quick Sort
2. Search Algorithms
Linear Search
Binary Search
3. Graph Algorithms
Fibonacci Sequence
5. Greedy Algorithms
Huffman Encoding
Binary Search
Merge Sort
7. Backtracking Algorithms
N-Queens Problem
8. Hashing Algorithms
Hash Tables
Cryptographic Hash Functions
Rabin-Karp Algorithm
1. Sorting Algorithms
Sorting is one of the most fundamental tasks in
programming. It involves arranging data in a particular
order, typically ascending or descending. Here are three
key sorting algorithms every developer should understand:
Bubble Sort
Bubble Sort works by repeatedly stepping through
the list, comparing adjacent elements, and swapping
them if they are in the wrong order. This process
continues until no swaps are needed, signaling that
the list is sorted.
Merge Sort
Merge Sort is a divide-and-conquer algorithm. It
divides the list into two halves, recursively sorts each
half, and then merges them back together in sorted
order. This is a more efficient approach than Bubble
Sort.
Quick Sort
Quick Sort is another divide-and-conquer algorithm
that picks a “pivot” element and partitions the list
around it. The elements smaller than the pivot go to
one side, and the larger ones go to the other. This
process is repeated recursively for each side.
2. Search Algorithms
Searching is another essential operation when dealing with
data. Whether you’re searching for a specific value in an
array or traversing a graph, these algorithms will help you
find what you’re looking for efficiently.
Linear Search
Linear Search involves going through each element in
a list one by one until the desired element is found.
Binary Search
Binary Search is an efficient searching algorithm that
works on sorted lists. It repeatedly divides the search
interval in half, comparing the target value to the
middle element. If the target is smaller, the search
continues in the left half; if it’s larger, the search
continues in the right half.
3. Graph Algorithms
Graphs are widely used in many applications, including
social networks, maps, and recommendation systems.
Understanding how to traverse and find the shortest path
in graphs is crucial for solving real-world problems.
Dijkstra’s Algorithm
Dijkstra’s algorithm finds the shortest path between
nodes in a graph, particularly in weighted graphs
where each edge has a cost. The algorithm iteratively
selects the vertex with the smallest known distance
and updates the distances of its neighbors.
Fibonacci Sequence
Dynamic programming can efficiently calculate the
Fibonacci sequence using a bottom-up approach.
Example: Calculating the 6th Fibonacci number:
5. Greedy Algorithms
Greedy algorithms build up a solution piece by piece,
always choosing the next piece that offers the most
immediate benefit.
Example: Activities with intervals (1, 3), (2, 5), (4, 6):
Huffman Encoding
Huffman Encoding is a compression algorithm that uses a
greedy approach to assign variable-length codes to
characters based on their frequencies.
Binary Search
Already covered earlier, Binary Search is a classic divide-
and-conquer algorithm.
Merge Sort
Merge Sort is also a divide-and-conquer algorithm, as
explained above.
7. Backtracking Algorithms
Backtracking is used to solve problems recursively by
trying partial solutions and abandoning them if they don’t
work.
N-Queens Problem
Place N queens on an N x N chessboard so no two queens
threaten each other.
Example: For the set {3, 34, 4, 12, 5, 2} and target 9, the
subset {4, 5} works.
8. Hashing Algorithms
Hashing algorithms efficiently map data to fixed-size
values for quick lookups.
Hash Tables
Hash tables store key-value pairs and use a hash function
to index data.
Rabin-Karp Algorithm
Rabin-Karp uses hashing to find a substring.
Example: Hash the pattern and sliding window hashes in
the text to locate matches.