DSA (Data Structuresand 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 likeGoogle, Microsoft, Amazon, Apple, Metaand many other heavily focus on DSA in interviews.
Are you looking to prepare in limited time ?Try our free courseGfG 160 where we have 160 most asked problems along with well written editorials and video explanations. The course also has 90 bonus problems.
Do you wish to learn in a scheduled manner ?Try our ongoing free courseDSA Skillup with weekly topic coverage with mock contests, short notes, daily problems and quizzes.
How to learn DSA?
- Learn at-least one programming language (C++,Java,Python orJavaScript) and build your basic logic.
- Learn about Time and Space complexities
- Learn Data Structures (Arrays, Linked List, etc) and Algorithms (Searching, Sorting, etc).
- Once you learn main topics, it is important tosolve coding problemsagainst some predefined test cases,
- Solve problems daily usingGfG Problem of the Day

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 allocatedcontiguous memory, allowing forconstant-time access.
4. Searching Algorithms
Searching algorithms are used to locate specific data within a large set of data. It helpsfind 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 toarrangethe elements of a list in aspecific order, such as numerical or alphabetical. It organizes the items in a systematic way, making it easier to search for and access specific elements.
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.
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 functioncalls itself within its own definition. It is usually used to solve problems that can be broken down into smaller instances of the same problem.
12. Matrix/Grid
Matrixis a two-dimensional array of elements, arranged inrowsandcolumns. It is represented as a rectangular grid, with each element at the intersection of a row and column.
13. Linked List
Linked listis 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 beaccessed sequentially, starting from the head of list.
14. Stack
Stack is a linear data structure that follows theLast 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.
15. Queue
Queue is a linear data structure that follows theFirst In, First Out (FIFO) principle. Queues play an important role in managing tasks or data in order, scheduling and message handling systems.
16. Deque
Adeque (double-ended queue) is a data structure that allows elements to be added or removed from both ends efficiently.
17. Tree
Tree is anon-linear, hierarchicaldata structure consisting of nodes connected by edges, with a top node called therootand nodes having child nodes. It is widely used infile systems,databases,decision-making algorithms, etc.
18. Heap
Heap is acomplete binary treedata structure that satisfies theheap property. Heaps are usually used to implementpriority queues, where thesmallestorlargestelement is always at the root of the tree.
19. Graph
Graph is a non-lineardata structure consisting of a finite set ofvertices(or nodes) and a set ofedges(or links)that connect a pair of nodes. Graphs are widely used to represent relationships between entities.
20. Greedy Algorithm
Greedy Algorithmbuilds 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 mostoptimal choice at that moment. So the problems where choosinglocally optimal also leads to the global solutions are best fit for Greedy.
21. Dynamic Programming
Dynamic Programming is a method used to solve complex problems by breaking them down into simplersubproblems. By solving each subproblem onlyonceandstoring the results, it avoids redundant computations, leading to moreefficient solutionsfor a wide range of problems.
22. Advanced Data Structure and Algorithms
Advanced Data Structures likeTrie,Segment Tree,Red-Black Tree andBinary Indexed Tree offer significant performance improvements for specific problem domains. They provide efficient solutions for tasks like fast prefix searches, range queries, dynamic updates, and maintaining balanced data structures, which are crucial for handling large datasets and real-time processing.
23. Other Algorithms
Bitwise Algorithms: Operate on individual bits of numbers.
Backtracking Algorithm : Follow Recursion with the option torevert and traces backif the solution from current point is not feasible.
Divide and conquer: A strategy to solve problems by dividing them intosmaller subproblems, solving those subproblems, and combining the solutions to obtain the final solution.
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 algorithmsare a set of algorithms that solve problems related toshapes,points,linesand polygons.
Randomized algorithmsare algorithms that userandomnessto solve problems. They make use of random input to achieve their goals, often leading tosimplerand moreefficient solutions. These algorithms maynot product same resultbut are particularly useful in situations when aprobabilistic approach is acceptable.