DSA Tutorial - Learn Data Structures and Algorithms
DSA (Data Structures and Algorithms) is the study of organizing data efficiently using data structures like arrays, stacks, and trees, paired with step-by-step procedures (or algorithms) to solve problems effectively. Data structures manage how data is stored and accessed, while algorithms focus on processing this data.
Why to Learn DSA?
- Learning DSA boosts your problem-solving abilities and make you a stronger programmer.
- DSA is foundation for almost every software like GPS, Search Engines, AI ChatBots, Gaming Apps, Databases, Web Applications, etc
- Top Companies like Google, Microsoft, Amazon, Apple, Meta and many other heavily focus on DSA in interviews.
How to learn DSA?
- Learn at-least one programming language (C++, Java, Python or JavaScript) and build your basic logic.
- Learn about Time and Space complexities
- Learn Data Structures and Algorithms
- Practice DSA
- Solve problems daily using GfG POTD, weekly using GfG Weekly Contest and monthly using GfG Job-A-Thon.

Hoping you have learned a programming language of your choice, here comes the next stage of the roadmap - Learn about Time and Space Complexities.
1. Logic Building
Once you have learned basics of a programming language, it is recommended that you learn basic logic building
2. Learn about Complexities
To analyze algorithms, we mainly measure order of growth of time or space taken in terms of input size. We do this in the worst case scenario in most of the cases. Please refer the below links for a clear understanding of these concepts.
3. Array
Array is a linear data structure where elements are allocated contiguous memory, allowing for constant-time access.
4. Searching Algorithms
Searching algorithms are used to locate specific data within a large set of data. It helps find a target value within the data. There are various types of searching algorithms, each with its own approach and efficiency.
5. Sorting Algorithm
Sorting algorithms are used to arrange the elements of a list in a specific order, such as numerical or alphabetical. It organizes the items in a systematic way, making it easier to search for and access specific elements.
- Guide on Sorting Algorithms
- Practice problems on Sorting algorithm
- Top Sorting Interview Questions and Problems
- Quiz on Sorting
6. Hashing
Hashing is a technique that generates a fixed-size output (hash value) from an input of variable size using mathematical formulas called hash functions. Hashing is commonly used in data structures for efficient searching, insertion and deletion.
- Guide on Hashing
- Practice Problems on Hashing
- Top 20 Hashing Technique based Interview Questions
- Quiz on Hashing
7. Two Pointer Technique
In Two Pointer Technique, we typically use two index variables from two corners of an array. We use the two pointer technique for searching a required point or value in an array.
8. Window Sliding Technique
In Window Sliding Technique, we use the result of previous subarray to quickly compute the result of current.
9. Prefix Sum Technique
In Prefix Sum Technique, we compute prefix sums of an array to quickly find results for a subarray.
10. String
String is a sequence of characters, typically immutable and have limited set of elements (lower case or all English alphabets).
11. Recursion
Recursion is a programming technique where a function calls itself within its own definition. It is usually used to solve problems that can be broken down into smaller instances of the same problem.
- Guide on Recursive Algorithms
- Practice Problems on Recursion algorithm
- Top 50 Problems on Recursion Algorithm for Interview
- Quiz on Recursion
12. Matrix/Grid
Matrix is a two-dimensional array of elements, arranged in rows and columns. It is represented as a rectangular grid, with each element at the intersection of a row and column.
- Matrix Data Structure Guide
- Practice Problems on Matrix/Grid
- Top 50 Problems on Matrix/Grid for Interviews
13. Stack
Stack is a linear data structure that follows the Last In, First Out (LIFO) principle. Stacks play an important role in managing function calls, memory, and are widely used in algorithms like stock span problem, next greater element and largest area in a histogram.
- Stack Data Structure Guide
- Practice Problems on Stack
- Top 50 Problems on Stack for Interviews
- Quiz on Stack
14. Queue
Queue is a linear data structure that follows the First In, First Out (FIFO) principle. Queues play an important role in managing tasks or data in order, scheduling and message handling systems.
- Queue Data Structure Guide
- Practice Problems on Queue
- Top 50 Problems on Queue for Interviews
- Quiz on Queue

15. Linked List
Linked list is a linear data structure that stores data in nodes, which are connected by pointers. Unlike arrays, nodes of linked lists are not stored in contiguous memory locations and can only be accessed sequentially, starting from the head of list.
- Linked List Data Structure Guide
- Practice problems on Linked Lists
- Top 50 Problems on Linked List for Interviews
- Quiz on Linked List
16. Tree
Tree is a non-linear, hierarchical data structure consisting of nodes connected by edges, with a top node called the root and nodes having child nodes. It is widely used in file systems, databases, decision-making algorithms, etc.
- Tree Data Structure Guide
- Practice Problems on Tree
- Top 50 Tree Coding Problems for Interviews
- Quiz on Tree
17. Heap
Heap is a complete binary tree data structure that satisfies the heap property. Heaps are usually used to implement priority queues, where the smallest or largest element is always at the root of the tree.
- Heap Data Structure Guide
- Practice Problems on Heap
- Top 50 Problems on Heap for Interviews
- Quiz on Heap
18. Graph
Graph is a non-linear data structure consisting of a finite set of vertices(or nodes) and a set of edges(or links)that connect a pair of nodes. Graphs are widely used to represent relationships between entities.
- Guide on Graph Algorithms
- Practice Problems on Graph
- Top 50 Problems on Graph for Interviews
- Quiz on Graph
19. Greedy Algorithm
Greedy Algorithm builds up the solution one piece at a time and chooses the next piece which gives the most obvious and immediate benefit i.e., which is the most optimal choice at that moment. So the problems where choosing locally optimal also leads to the global solutions are best fit for Greedy.
- Guide on Greedy Algorithms
- Practice Problems on Greedy Algorithm
- Top 20 Greedy Algorithm Interview Questions
- Quiz on Greedy
20. Dynamic Programming
Dynamic Programming is a method used to solve complex problems by breaking them down into simpler subproblems. By solving each subproblem only once and storing the results, it avoids redundant computations, leading to more efficient solutions for a wide range of problems.
- Dynamic Programming Guide
- Practice Problems on Dynamic Programming
- Top 50 Dynamic Programming Coding Problems for Interviews
- Quiz on DP
21. Other Algorithms
Bitwise Algorithms: Operate on individual bits of numbers.
Backtracking Algorithm : Follow Recursion with the option to revert and traces back if the solution from current point is not feasible.
- Guide on Backtracking Algorithms
- Practice Problems on Backtracking algorithm
- Top 20 Backtracking Algorithm Interview Questions
- Quiz on Backtracking
Divide and conquer: A strategy to solve problems by dividing them into smaller subproblems, solving those subproblems, and combining the solutions to obtain the final solution.
- Guide on Divide and Conquer Algorithm
- Practice problems on Divide And Conquer algorithm
- Quizzes on Divide and Conquer
Branch and Bound : Used in combinatorial optimization problems to systematically search for the best solution. It works by dividing the problem into smaller subproblems, or branches, and then eliminating certain branches based on bounds on the optimal solution. This process continues until the best solution is found or all branches have been explored.
Geometric algorithms are a set of algorithms that solve problems related to shapes, points, lines and polygons.
Randomized algorithms are algorithms that use randomness to solve problems. They make use of random input to achieve their goals, often leading to simpler and more efficient solutions. These algorithms may not product same result but are particularly useful in situations when a probabilistic approach is acceptable.
Cheat Sheets
- Blind 75
- SDE SHEET – A Complete Guide for SDE Preparation
- GeeksforGeeks Master Sheet – List of all Cheat Sheets
Related Article:


