Learn DSA
Choose a guided starting point and build up your problem-solving skills.
DSA Fundamentals
An algorithm transforms an input according to rules. A data structure organizes the values those rules need. Begin by counting one operation while the input grows.
Arrays and Hashing
Arrays give a stable index to each slot. A hash table associates a key with a remembered fact, such as its first position or frequency.
Sorting Algorithms
A sorting algorithm repeatedly strengthens an order guarantee. Different algorithms spend comparisons, writes and auxiliary memory differently.
Strings
Treat a string as an ordered sequence and choose what counts as a character before you count, compare or search.
Two Pointers
Two positions describe the part of a sequence still relevant. Each safe pointer move removes candidates or extends an established prefix.
Sliding Window
A window keeps a contiguous span and updates its summary when either boundary moves.
Binary Search
Binary search picks a midpoint and uses sorted order or a monotone yes/no test to discard a whole interval of impossible answers.
Linked Lists
A linked node carries a value and a reference to its successor. Positions come from following links from the head.
Stacks and Queues
A stack removes the most recent item. A queue removes the earliest waiting item. A deque permits operations at either end.
Recursion and Backtracking
A recursive call solves a smaller instance. Backtracking explores sibling choices by restoring shared state between branches.
Trees, BSTs and Tries
A rooted tree gives each non-root node one parent. Traversal order decides when the root of each subtree is processed.
Heaps and Priority Queues
A heap guarantees that the root outranks every descendant. Siblings can appear in either order.
Graphs
Edges connect vertices that may have multiple routes between them. Traversal needs an explicit policy for visiting each vertex.
Dynamic Programming
Define a state whose value can be reused. Derive a recurrence from the final choice, then evaluate states in dependency order.
Greedy Algorithms and Intervals
A greedy rule commits to a local choice whose safety can be justified. Interval problems often expose this rule after sorting endpoints.
Bit Manipulation
Binary digits encode switches, powers of two and membership in a small set. Bit operations can inspect or change several switches at once.
Pause and Predict
Pause a binary search before the boundary update and predict its next interval.
Find 19 in the sorted array. The current midpoint is index 3.
- 20
- 51
- 72
- 11probe 3
- 144
- 195
- 236
Which action should the search take now?