DSA Beginner to Advanced Roadmap by Sandeep Jain
A detailed roadmap designed for aspiring programmers looking to kickstart their Data Structures and Algorithms journey, created, curated and organised by the CEO himself.
25
Chapters
3
Quizzes
50+
Articles
500
Problems
Discover a smoother learning journey through our effortless roadmap
Start your journeyChapters
Analysis of Algorithms
Asymptotic Notation and Analysis (Based on input size) in Complexity Analysis of Algorithms
Asymptotic Notations and how to calculate them
Worst, Average and Best Case Analysis of Algorithms
Big O Notation Tutorial - A Guide to Big O Analysis
Analysis of Algorithms | Big-Omega Ω Notation
Analysis of Algorithms | Big - Θ (Big Theta) Notation
How to Analyse Loops for Complexity Analysis of Algorithms
How to analyse Complexity of Recurrence Relation
How to solve time complexity Recurrence Relations using Recursion Tree method?
What does 'Space Complexity' mean?
Arrays
Getting Started with Array Data Structure
Types of Arrays
How do Dynamic arrays work?
Search, Insert, and Delete in an Unsorted Array | Array Operations
Search, Insert, and Delete in an Sorted Array | Array Operations
Array Reverse - Complete Tutorial
Sort an array of 0s, 1s and 2s | Dutch National Flag problem
Find a peak element which is not smaller than its neighbours
Program to find the minimum (or maximum) element of an array
Count number of occurrences (or frequency) in a sorted array
Subarray with Given Sum
Program to cyclically rotate an array by one
Find the Missing Number
Count pairs with given sum
Find duplicates in O(n) time and O(1) extra space | Set 1
Find first non-repeating element in a given Array of integers
Count subarrays with equal number of 1's and 0's
Subarray with 0 sum
Maximum Subarray Sum - Kadane's Algorithm
Minimize the maximum difference between the heights
Find the row with maximum number of 1s
Find whether an array is subset of another array
Majority Element
Sort an array in wave form
Maximum Sum Path in Two Arrays
Missing and Repeating in an Array
Closest Pair Sum in a Sorted Array
Find the smallest positive integer value that cannot be represented as sum of any subset of a given array
Matrix
Matrix or Grid or 2D Array - Complete Tutorial
Search in a row wise and column wise sorted matrix
Print matrix in zig-zag fashion
Print a given matrix in spiral form
Shift matrix elements row-wise by k
Program to find transpose of a matrix
Inplace (Fixed space) M x N size matrix transpose
Rotate Square Matrix by 90 Degrees Counterclockwise
Mirror of matrix across diagonal
Program for Conway's Game Of Life
Check if all rows of a matrix are circular rotations of each other
Count zeros in a row wise and column wise sorted matrix
Minimum flip required to make Binary Matrix symmetric
Program to multiply two matrices
Queries in a Matrix
Find pairs with given sum such that elements of pair are in different rows
Find all permuted rows of a given row in a matrix
Find number of transformation to make two Matrix Equal
Magic Square | ODD Order
A Boolean Matrix Question
Print K'th element in spiral form of matrix
Find size of the largest '+' formed by all ones in a binary matrix
Validity of a given Tic-Tac-Toe board configuration
Strings
Introduction to Strings - Data Structure and Algorithm Tutorials
Reverse words in a string
Longest Common Prefix using Sorting
Find the minimum distance between the given two words
Check if two given Strings are Isomorphic to each other
Check if a string can be obtained by rotating another string 2 places
Find largest word in dictionary by deleting some characters of given string
Multiply Large Numbers represented as Strings
Find Excel column name from a given column number
Find the longest substring with k unique characters in a given string
Smallest window in a String containing all characters of other String
Longest substring without repeating characters
Count of substrings of length K with exactly K distinct characters
Count number of substrings with exactly k distinct characters
Given a sequence of words, print all anagrams together | Set 1
Minimum number of deletions to make a string palindrome
KMP Algorithm for Pattern Searching
Longest prefix which is also suffix
Rabin-Karp Algorithm for Pattern Searching
Z algorithm (Linear time pattern searching Algorithm)
Number of distinct words of size N with at most K contiguous vowels
Longest substring whose characters can be rearranged to form a Palindrome
Linked List
Introduction to Linked List - Data Structure and Algorithm Tutorials
Linked List vs Array
Find Middle of the Linked List
Reverse a Linked List
Reverse a Doubly Linked List
Rotate a Linked List
Program for Nth node from the end of a Linked List
Delete last occurrence of an item from linked list
Detect loop or cycle in a linked list
Traversal of Circular Linked List
Pairwise Swap Elements of a given Linked List
Reverse a Linked List in groups of given size
Merge two sorted linked lists
Detect and Remove Loop in Linked List
Delete all occurrences of a given key in a linked list
Write a function to get the intersection point of two Linked Lists
Intersection of two Sorted Linked Lists
Remove duplicates from an unsorted doubly linked list
Add two numbers represented as Linked List
Multiply two numbers represented by Linked Lists
Swap Kth node from beginning with Kth node from end in a Linked List
Construct a linked list from 2D matrix
Reverse a sublist of linked list
Rearrange a given linked list in-place
Reverse alternate K nodes in a Singly Linked List
Merge K sorted linked lists
Flattening a Linked List
Clone a linked list with next and random pointer
Mathematical Programs
Count digits in an integer (4 Different Methods)
Check if a number is Palindrome
Factorial of a Number
Program to Find GCD or HCF of Two Numbers
Program to find LCM of two numbers
Prime Numbers
Prime Factorization using Sieve O(log n) for multiple queries
Sieve of Eratosthenes
Compute power of power k times % m
LCM of given array elements
GCD of more than two (or array) numbers
Modular Exponentiation (Power in Modular Arithmetic)
Nth Fibonacci Number
Bitwise Manipulations
Set the K-th bit of a given number
Program to clear K-th bit of a number N
Toggling k-th bit of a number
Count set bits in an integer
Program to find whether a given number is power of 2
Minimum Bit Flips to convert A to B
Position of rightmost set bit
How to swap two numbers without using a temporary variable?
Highest power of 2 less than or equal to given number
Count set bits in a range
Find the two numbers with odd occurrences in an unsorted array
Check if binary representation of a number is palindrome
Missing and Repeating in an Array
Minimum XOR Value Pair
Count total set bits in first N Natural Numbers (all numbers from 1 to N)
Find the n-th number whose binary representation is a palindrome
Single Element Amid Triples
Count subarrays with equal number of 1's and 0's
Count number of subsets having a particular XOR value
Find the maximum subset XOR of a given set
Searching
Introduction to Linear Search Algorithm
Binary Search Algorithm - Iterative and Recursive Implementation
Find the first repeating element in an array of integers
Missing and Repeating in an Array
Given Array of size n and a number k, find all elements that appear more than n/k times
Two Sum - Pair Closest to 0
Find a pair with the given difference
Kth smallest element in a row-wise and column-wise sorted 2D array
Ceiling in a sorted array
Find the closest pair from two sorted arrays
Minimum in a Sorted and Rotated Array
Find k closest elements to a given value
Find a Fixed Point (Value equal to index) in a given array
Median of two Sorted Arrays of Different Sizes
Search in an almost sorted array
Find if there is a pair with a given sum in the rotated sorted Array
Sorting
Introduction to Sorting Techniques
Bubble Sort Algorithm
Selection Sort
Insertion Sort Algorithm
Quick Sort
Merge Sort - Data Structure and Algorithms Tutorials
Sort elements by frequency
Sort numbers stored on different machines
Sort even-placed elements in increasing and odd-placed in decreasing order
Sort a nearly sorted (or K sorted) array
Sort a Matrix in all way increasing order
Count distinct occurrences as a subsequence
K-th smallest element after removing some integers from natural numbers
Merge Overlapping Intervals
Maximum difference between frequency of two elements such that element having greater frequency is also greater
Minimum swaps to reach permuted array with at most 2 positions left swaps allowed
Find whether it is possible to make array elements same using one external number
Sort an array after applying the given equation
Count minimum number of subsets (or subsequences) with consecutive numbers
Choose k array elements such that difference of maximum and minimum is minimized
Hashing
Introduction to Hashing
Find whether an array is subset of another array
Frequency of each character in a String using unordered_map in C++
Find first non-repeating character of given String
Union and Intersection of Two Unsorted Arrays - Complete Tutorial
Find missing elements of a range
Pair with given Sum (Two Sum)
Remove duplicates from Sorted Array
Longest Consecutive Subsequence
Given a sequence of words, print all anagrams together | Set 1
Longest sub-array having sum k
Largest subarray with equal number of 0s and 1s
Sort an array according to the order defined by another array
Smallest subarray with k distinct numbers
Longest Subarray with 0 Sum
Count the number of subarrays having a given XOR
Transform One String to Another using Minimum Number of Given Operation
Longest subarray with sum divisible by K
Count distinct elements in every window of size k
Check if an array can be divided into pairs whose sum is divisible by k
Stack
What is Stack Data Structure? A Complete Tutorial
Implement a stack using singly linked list
Convert Infix expression to Postfix expression
Evaluation of Postfix Expression
Convert Infix To Prefix Notation
Evaluation of Prefix Expressions
Valid Parentheses in an Expression
How to Reverse a String using Stack
Reverse individual words
Next Greater Element (NGE) for every element in given Array
Previous greater element
Trapping Rain Water Problem - Tutorial with Illustrations
The Stock Span Problem
Delete consecutive same words in a sequence
Lexicographically largest subsequence containing all distinct characters only once
Minimize length by removing subsequences forming valid parenthesis from a given string
Clone a stack without using extra space | Set 2
Longest Valid Parentheses Substring
Next Greater Frequency Element
Maximum product of indexes of next greater on left and right
Largest Rectangular Area in a Histogram
Design a stack that supports getMin() in O(1) time and O(1) extra space
Stack Permutations (Check if an array is stack permutation of other)
Check if two expressions with brackets are same
Design Browser History
Find maximum of minimum for every window size in a given array
Queue
Introduction to Queue Data Structure
Reversing a Queue
Reversing the first K elements of a Queue
Introduction and Array Implementation of Queue
Implement Stack using Queues
Find the first circular tour that visits all petrol pumps
An Interesting Method to Generate Binary Numbers from 1 to n
Check if a queue can be sorted into another queue using a stack
Interchange elements of Stack and Queue without changing order
Deque
Deque | Set 1 (Introduction and Applications)
Implementation of Deque using circular array
Lexicographically largest permutation by sequentially inserting Array elements at ends
Generate Bitonic Sequence of length N from integers in a given range
Length of all prefixes that are also the suffixes of given string
Sliding Window Maximum (Maximum of all subarrays of size K)
LRU Cache - Complete Tutorial
Reduce the given Array of [1, N] by rotating left or right based on given conditions
Create a new linked list from maximum square differences
Substring of length K having maximum frequency in the given string
Heap
Introduction to Heap
Binary Heap
Insertion and Deletion in Heaps
Introduction to Max-Heap – Data Structure and Algorithm Tutorials
Introduction to Min-Heap Data Structure
Minimum product of k integers in an array of positive Integers
Print K largest(or smallest) elements in an array
Top K Frequent Elements in an Array
K'th largest element in a stream
Largest triplet product in a stream
Minimum sum of two numbers formed from digits of an array
Connect n ropes with minimum cost
K maximum sum combinations from two arrays
Maximum sum of at most two non-overlapping intervals in a list of Intervals | Interval Scheduling Problem
Merge k Sorted Arrays
Find Median from Running Data Stream
Find smallest range containing elements from k lists
Merge two sorted arrays in O(1) extra space using Heap
Recursion Algorithm
Introduction to Recursion
Sum of natural numbers using recursion
Print reverse of a string using recursion
Sum of digit of a number using recursion
Factorial of a Number
Recursive Programs to find Minimum and Maximum elements of array
Count Set-bits of number using Recursion
Print Fibonacci Series in reverse order using Recursion
Flood Fill Algorithm
Recursively remove all adjacent duplicates
Binary to Gray code using recursion
Delete a linked list using recursion
Length of longest palindromic sub-string : Recursion
Program for Tower of Hanoi Algorithm
Print all possible paths from top left to bottom right in matrix
Find the value of a number raised to its reverse
Print all Palindromic Partitions of a String using Backtracking
Check if a string is a scrambled form of another string
Print all Palindromic Partitions of a String using Bit Manipulation
Backtracking
Introduction to Backtracking
Rat in a Maze
N Queen Problem
Algorithm to Solve Sudoku | Sudoku Solver
Permutations of given String
Subset Sum Problem using Backtracking
Longest Possible Route in a Matrix with Hurdles
Find shortest safe route in a path with landmines
Word Break Problem using Backtracking
Remove Invalid Parentheses
Printing all solutions in N-Queen Problem
Find if there is a path of more than k length from a source
Partition of a set into K subsets with equal sum
Tug of War
Tree
Introduction to Tree Data Structure
Tree Traversal Techniques
Types of Trees in Data Structures
Level Order Traversal (Breadth First Search or BFS) of Binary Tree
Level order traversal in spiral form
Maximum Depth or Height of Binary Tree
Program to Determine if given Two Trees are Identical or not
Invert Binary Tree - Change to Mirror Tree
Symmetric Tree (Mirror Image of itself)
Balanced Binary Tree or Not
Largest value in each level of Binary Tree
ZigZag Tree Traversal
Print Right View of a Binary Tree
Print Nodes in Top View of Binary Tree
Bottom View of a Binary Tree using Recursion
Diameter of a Binary Tree in O(n) [A new method]
Vertical Traversal of a Binary Tree using Preorder
Construct Tree from given Inorder and Preorder traversals
Convert Binary Tree to Doubly Linked List by keeping track of visited node
Construct BST from Preorder Traversal
Find distance between two nodes of a Binary Tree
Find the maximum sum leaf to root path in a Binary Tree
Difference between sums of odd level and even level nodes of a Binary Tree
Maximum sum of nodes in Binary tree such that no two are adjacent
Print Ancestors of a given node in Binary Tree
Lowest Common Ancestor in a Binary Tree
Check if a given Binary Tree is Sum Tree
Left View of a Binary Tree
Maximum Path Sum in a Binary Tree
Boundary Traversal of binary tree
Print all nodes at distance k from a given node
Serialize and Deserialize a Binary Tree
Count number of nodes in a complete Binary Tree
Find the maximum path sum between two leaves of a binary tree
Count all K Sum Paths in Binary Tree
Burn the binary tree starting from the target node
Clone a Binary Tree with Random Pointers
Binary Search Tree
Introduction to Binary Search Tree
Searching in Binary Search Tree (BST)
Deletion in Binary Search Tree (BST)
Self-Balancing Binary Search Trees
AVL Tree Data Structure
Introduction to Red-Black Tree
Iterative searching in Binary Search Tree
Check if a Binary Tree is BST or not
Find the node with minimum value in a Binary Search Tree
Check if an array represents Inorder of Binary Search tree or not
Check for Identical BSTs without building the trees
Second largest element in BST
Check if two BSTs contain same set of elements
Construct BST from Preorder Traversal
Transform a BST to greater sum tree
BST to a Tree with sum of all smaller keys
LCA in BST - Lowest Common Ancestor in Binary Search Tree
k-th Smallest in BST (Order Statistics in BST)
K'th Largest element in BST using constant extra space
Largest number in BST which is less than or equal to N
Shortest distance between two nodes in BST
Inorder predecessor and successor in BST
Two Sum in BST - Pair with given sum
Maximum element between two nodes of BST
Largest BST Subtree - Simple Implementation
Recover BST - Two Nodes are Swapped, Correct it
How to handle duplicates in Binary Search Tree?
Construct all possible BSTs for keys 1 to N
Merge two BSTs with limited extra space
K'th Largest Element in BST when modification to BST is not allowed
Maximum Unique Element in every subarray of size K
Inversion count in Array Using Self-Balancing BST
Merge Two Balanced Binary Search Trees
Greedy Algorithm
Greedy Algorithm Tutorial - Examples, Application and Practice Problem
Activity Selection Problem | Greedy Algo-1
Fractional Knapsack Problem
Job Sequencing Problem
Ford-Fulkerson Algorithm for Maximum Flow Problem
What is Dijkstra’s Algorithm? | Introduction to Dijkstra's Shortest Path Algorithm
Kruskal’s Minimum Spanning Tree (MST) Algorithm
Prim’s Algorithm for Minimum Spanning Tree (MST)
Huffman Coding | Greedy Algo-3
Buy Maximum Stocks if i stocks can be bought on i-th day
Find the minimum and maximum amount to buy all N candies
Divide cuboid into cubes such that sum of volumes is maximum
Minimum rooms for m events of n batches with given schedule
Minimum cost to make array size 1 by removing larger of pairs
Minimum increment by k operations to make all elements equal
Smallest subset with sum greater than all other elements
Minimum Platforms Required for Given Arrival and Departure Times
Divide 1 to n into two groups with minimum sum difference
Paper Cut into Minimum Number of Squares
Minimum difference between groups of size two
Largest palindromic number by permuting digits
Find smallest number with given number of digits and sum of digits
Greedy Algorithm to find Minimum number of Coins
Graph Coloring Using Greedy Algorithm
Greedy Approximate Algorithm for K Centers Problem
Shortest Superstring Problem
Approximate solution for Travelling Salesman Problem using MST
Dynamic Programming
Dynamic Programming (DP) Tutorial with Problems
What is Memoization? A Complete Tutorial
Tabulation vs Memoization
Minimize steps to reach K from 0 by adding 1 or doubling at each step
Count number of ways to cover a distance
Minimum number of deletions and insertions to transform one string into another
Find the longest path in a matrix with given constraints
Maximum sum path in a Matrix
Longest Increasing Subsequence (LIS)
Longest Common Subsequence (LCS)
Word Wrap Problem
Maximum Product Cutting | DP-36
Rod Cutting
Maximum Length Chain of Pairs | DP-20
Maximum Sum Increasing Subsequence | DP-14
Minimum perfect squares to add that sum to given number.
Longest Palindromic Substring
Number of Unique BST with a given key | Dynamic Programming
Minimum insertions to form a palindrome | DP-28
Count All Palindromic Subsequence in a given String
Partition a Set into Two Subsets of Equal Sum
Palindrome Partitioning
Check if a String is Interleaving of Other Two
Partition a set into two subsets such that the difference of subset sums is minimum
Boolean Parenthesization Problem | DP-37
Longest Zig-Zag Subsequence
Stock Buy and Sell - At-most k Transactions Allowed
The Painter's Partition Problem
Matrix Chain Multiplication
Graph
Introduction to Graph Data Structure
Graph and its representations
Breadth First Search or BFS for a Graph
Depth First Search or DFS for a Graph
Print Adjacency List for a Directed Graph
Word Search in a 2D Grid of characters
Boggle (Find all possible words in a board of characters) | Set 1
Word Ladder (Length of shortest chain to reach a target word)
Flood fill Algorithm - how to implement fill() in paint?
Given a matrix of ‘O’ and ‘X’, replace 'O' with 'X' if surrounded by 'X'
Rotten Oranges - Minimum Time to Rot All
Minimum number of swaps required to sort an array
Minimum steps to reach target by a Knight | Set 1
Count all possible Paths between two Vertices
Find whether there is path between two cells in matrix
Kahn's algorithm for Topological Sorting
Check if it is possible to finish all task from given dependencies (Course Schedule I)
Find the ordering of task from given dependencies (Course Schedule II)
How to find Shortest Paths from Source to all Vertices using Dijkstra's Algorithm
Floyd Warshall Algorithm
Find number of closed islands in given Matrix
Minimum Cost Path with Left, Right, Bottom and Up moves allowed
Strongly Connected Components
Tarjan's Algorithm to find Strongly Connected Components
Hamiltonian Cycle
Bridges in a graph
Articulation Points (or Cut Vertices) in a Graph
Alien Dictionary
Print all possible shortest chains to reach a target word
Shortest path by removing K walls
Shortest Path in Directed Acyclic Graph
Find minimum weight cycle in an undirected graph
Detect cycle in an undirected graph
Trie
Trie Data Structure Tutorial
Trie Data Structure | Insert and Search
Trie | (Delete)
Longest Common Prefix using Trie
Count number of Distinct Substring in a String
Maximum XOR of Two Numbers in an Array
Maximum number of Strings with Common Prefix of length K
Maximize Bitwise XOR of K with two numbers from Array
Maximum common prefix of all strings
Count of Strings of Array having given prefixes for Q query
Search a string in the dictionary with a given prefix and suffix for Q queries
Queries to calculate maximum Bitwise XOR of X with any array element not exceeding M
Spell Checker using Trie
Segment Tree
Introduction to Segment Trees
Segment Tree | Sum of given range
Segment Tree | Range Minimum Query
Lazy Propagation in Segment Tree
Min-Max Range Queries in Array
Querying maximum number of divisors that a number in a given range has
Flipping Sign Problem | Lazy Propagation Segment Tree
Queries to check if any non-repeating element exists within range [L, R] of an Array
Range LCM Queries
Range query for Largest Sum Contiguous Subarray
Maximum Occurrence in a Given Range
Queries to find maximum product pair in range with updates
Queries to evaluate the given equation in a range [L, R]
Length of Longest Subarray with same elements in atmost K increments
Calculate the Sum of GCD over all subarrays
Range Queries for Longest Correct Bracket Subsequence
Range and Update Query for Chessboard Pieces
Generate original permutation from given array of inversions
Count number of increasing sub-sequences : O(NlogN)
Reconstructing Segment Tree
Disjoint Set
Introduction to Disjoint Set (Union-Find Algorithm)
Union By Rank and Path Compression in Union-Find Algorithm
Detect Cycle in Graph using DSU
Connected Components in an Undirected Graph
Number of Islands
Replace all occurrences of X by Y for Q queries in given Array
Minimum cost to connect all cities
The Earliest Moment When Everyone Become Friends
Minimum cost to connect all houses in a city
Lexicographically minimum String possible
Job Sequencing Problem using Disjoint Set
Path queries through restricted weighted edges
DSA Quiz for Beginners to Advanced
About DSA Roadmap for Beginner to Advanced
An extensive interview-centric roadmap designed by the CEO to help you ace your DSA preparations. We will help you enhance your conceptual knowledge about DSA and improve your problem-solving and coding skills. The main focus of this DSA Roadmap will be to help you get started and become a Pro in Data Structures and Algorithms, with additional benefit to prepare for coding interviews of product-based companies like Microsoft, Uber, Amazon, and many more!
Why take this DSA Roadmap for Beginners to Advanced by Sandeep Jain?
With a passion for teaching, our CEO has taken countless sessions and has provide proven tailored guidance to all the aspiring coders over the years. Launch a successful tech career with his structured learning methods, and gain his:
- Industry Expertise
- Extensive Teaching Experience
- Student Friendly Approach
Why Data Structures and Algorithms Are Important to Learn?
Data structures and algorithms play a major role in implementing software and in the hiring process as well. In our daily life, we always go with the choice which can complete the task in a short amount of time and with efficiency, using fewer resources. The same happens with these companies. The problem faced by these companies is much harder and on a much larger scale. Software developers also have to make the right decisions when it comes to solving the problems of these companies. Knowledge of Data Structures and Algorithms goes a long way in solving these problems efficiently and the interviewers are more interested in seeing how candidates use these tools to solve a problem.
If you want to know more about Why Data Structures and Algorithms, then you must opt this DSA Roadmap for Beginners to Advanced by Mr. Sandeep Jain (CEO & Founder, GeeksforGeeks).
Reviews
Abhishek sirohi
The roadmap provided here is a very good start to understanding the basics and covers all types of DSA concepts. I am completely satisfied with this roadmap.
Ayan Prakash
There is a clear explanation of all topics covered in this roadmap, and the practice problems that are provided are very helpful to help implement the concepts learned. Kudos to GeeksforGeeks!!!
Nupur Bisht
There is no doubt that GeeksforGeeks has covered all the important topics in the most effective way. As a result of this roadmap, I am placed in very good company.
Tanisha Singh
In my opinion, the roadmap of GFG is very well structured. It's awesome how they arranged the readings. I found it to be very helpful.
FAQ's
How can I start this course?
You just need to click on the button that says START YOUR JOURNEY, and that's it. You will be taken to your first chapter.
Is this a language-specific course?
No. Majority topics in the course include implementations in popular programming languages like C, C++, Java, Python, C#, and Javascript.
Does the course include programming questions?
Yes, the course focuses on DS & Algo with a mix of theoretical topics and programming questions.
Can I learn DSA live?
Yes, we do have LIVE batched for DSA. You may call us on our toll-free number: +91-7838223507 or Drop us an email at courses@geeksforgeeks.org for any queries.

