Skip to content

Data Structures & Algorithms

Data structures (arrays, trees, graphs) and algorithms (sorting, searching, DP) with code examples in Python and JavaScript — coding interview prep

76 Published

In this tutorial, you will learn about Data Structures Algorithms. We cover key concepts, practical examples, and best practices to help you master this topic.

Comprehensive data structures algorithms tutorials covering everything from qubits and Superposition to advanced algorithms and real-world applications.

Additional Classic Tutorials

Algorithm Design Techniques -- Divide & Conquer, Transform & Conquer Guide
Binary Search Trees -- Insert, Search & Delete Guide
Binary Trees -- Traversals & Operations Guide
Breadth-First Search (BFS) -- Graph Traversal Guide
Depth-First Search (DFS) -- Graph Traversal Guide
Dijkstra's Algorithm -- Shortest Path Guide
Dynamic Programming -- Memoization & Tabulation Guide
Graphs -- Adjacency List & Matrix Representation Guide
Hash Tables -- Dictionary & HashMap Guide
Heaps -- Min-Heap & Max-Heap Guide
Linked Lists -- Singly, Doubly & Circular Guide
Queues -- FIFO, Priority & Deque Guide
Sorting Algorithms -- Comparison & Selection Guide
Stacks -- LIFO Data Structure Guide
String Algorithms -- Pattern Matching & Manipulation Guide
Trie Data Structure -- Prefix Tree Guide

Published Topics

Linked Lists — Singly, Doubly & Circular Guide

Linked lists store elements in nodes with pointers to the next node. Learn singly, doubly, and circular linked lists with Python and JavaScript code examples.

✓ Live

Stacks — LIFO Data Structure Guide

A stack is a Last-In-First-Out (LIFO) data structure. Learn stack operations, implementations, and real-world applications with Python and JavaScript examples.

✓ Live

Queues — FIFO, Priority & Deque Guide

A queue is a First-In-First-Out (FIFO) data structure. Learn linear queues, priority queues, deques, and circular queues with Python and JavaScript examples.

✓ Live

Hash Tables — Dictionary & HashMap Guide

Hash tables store key-value pairs with O(1) average lookup time. Learn hash functions, collision resolution, load factor, and implementations in Python and JavaScript.

✓ Live

Binary Trees — Traversals & Operations Guide

Binary trees store data hierarchically with each node having at most two children. Learn tree traversals (inorder, preorder, postorder, level-order) with Python and JavaScript.

✓ Live

Binary Search Trees — Insert, Search & Delete Guide

A Binary Search Tree (BST) maintains sorted data with O(log n) average operations. Learn BST insert, search, delete, and validation with Python and JavaScript.

✓ Live

Heaps — Min-Heap & Max-Heap Guide

A heap is a complete binary tree that satisfies the heap property. Learn min-heap, max-heap, heapify, and heap sort with Python and JavaScript implementations.

✓ Live

Graphs — Adjacency List & Matrix Representation Guide

Graphs model relationships between entities using vertices and edges. Learn adjacency list and adjacency matrix representations with Python and JavaScript code examples.

✓ Live

Trie Data Structure — Prefix Tree Guide

A trie (prefix tree) stores strings with shared prefixes. Learn trie operations for autocomplete, spell checking, and prefix matching with Python and JavaScript.

✓ Live

Sorting Algorithms — Comparison & Selection Guide

Sorting algorithms are fundamental to computer science. Compare bubble sort, merge sort, quick sort, heap sort, insertion sort, and selection sort with complexity analysis.

✓ Live

Depth-First Search (DFS) — Graph Traversal Guide

DFS explores graph paths as deep as possible before backtracking. Learn recursive and iterative DFS, cycle detection, topological sort, and implementations in Python and JavaScript.

✓ Live

Breadth-First Search (BFS) — Graph Traversal Guide

BFS explores graph level by level using a queue. Learn BFS traversal, shortest path in unweighted graphs, and implementations in Python and JavaScript with real-world applications.

✓ Live

Dijkstra's Algorithm — Shortest Path Guide

Dijkstra's algorithm finds the shortest path from a source node to all other nodes in weighted graphs. Learn the algorithm with Python and JavaScript implementations using priority queues.

✓ Live

Dynamic Programming — Memoization & Tabulation Guide

Dynamic Programming solves complex problems by breaking them into overlapping subproblems. Learn memoization (top-down) and tabulation (bottom-up) with Python and JavaScript examples.

✓ Live

String Algorithms — Pattern Matching & Manipulation Guide

String algorithms efficiently search, match, and manipulate text. Learn KMP, Rabin-Karp, Z-algorithm, and string hashing with Python and JavaScript implementations.

✓ Live

Algorithm Design Techniques — Divide & Conquer, Transform & Conquer Guide

Algorithm design techniques provide templates for solving problems. Learn divide and conquer, transform and conquer, decrease and conquer, and brute force with Python and JavaScript.

✓ Live

Big O Notation Explained: Time & Space Complexity Guide

Learn Big O notation to analyze algorithm efficiency: measure time and space complexity with practical examples for coding interviews and optimized development.

✓ Live

Time Complexity Analysis: Best, Average & Worst Case Guide

Learn time complexity analysis for algorithms: understand best, average, and worst-case scenarios with Big O, Omega, and Theta notations explained step by step.

✓ Live

Space Complexity Analysis: Memory Usage Optimization Guide

Learn space complexity analysis to optimize memory usage in algorithms: auxiliary space, recursion stack depth, and memory tradeoffs for writing efficient code.

✓ Live

Asymptotic Notations: Big O, Omega & Theta Explained

Learn asymptotic notations Big O, Omega, and Theta to mathematically analyze algorithm performance and compare efficiency across different input sizes.

✓ Live

Amortized Analysis: Dynamic Array Cost Distribution Guide

Learn amortized analysis to understand how costly operations spread across multiple cheaper operations using aggregate, accounting, and potential methods.

✓ Live

Space-Time Tradeoff: Balancing Memory and Speed in Algorithms

Learn the space-time tradeoff in algorithm design: how using more memory can accelerate operations with caching, memoization, and precomputation examples.

✓ Live

Recursion Basics: Base Cases, Call Stack & Recursive Thinking Guide

Learn recursion fundamentals: master base cases, recursive cases, call stack behavior, and develop recursive thinking for solving complex problems elegantly.

✓ Live

Iteration vs Recursion: Performance, Readability & Use Cases Compared

Learn the key differences between iteration and recursion: compare performance, memory usage, readability, and choose the approach for your algorithm problems.

✓ Live

Two-Pointer Technique: Array & String Problem-Solving Guide

Learn the two-pointer technique for solving array and string problems: pair sums, palindrome checking, and in-place array modifications with linear time.

✓ Live

Sliding Window Technique: Subarray & Substring Problems Guide

Learn the sliding window technique for subarray and substring problems: fixed and variable window patterns for max sum, longest substring, and optimal results.

✓ Live

Array Rotation: Left, Right & Block Swap Algorithms Guide

Learn array rotation algorithms using reversal, juggling, and block swap: rotate arrays left and right with optimal O(n) time and O(1) space complexity.

✓ Live

Prefix Sum Technique: Range Query Optimization Guide

Learn the prefix sum technique for fast range sum queries: precompute cumulative sums to answer subarray sum queries in constant time for competitive coding.

✓ Live

Kadane's Algorithm: Maximum Subarray Sum Explained

Learn Kadane's algorithm to find the maximum subarray sum in linear time: understand the dynamic programming pattern behind this classic interview problem.

✓ Live

Monotonic Stack: Next Greater Element & Stock Span Guide

Learn the monotonic stack pattern for next greater element, stock span, and largest rectangle problems using stack-based algorithms for efficient solutions.

✓ Live

String Manipulation: Reversal, Anagram & Palindrome Guide

Learn essential string manipulation algorithms: reversing strings, checking anagrams and palindromes, and pattern matching techniques for coding interview prep.

✓ Live

Subarray vs Subsequence: Key Differences & Algorithm Patterns Guide

Learn the critical difference between subarrays and subsequences: contiguous vs non-contiguous patterns with algorithms for each and real coding examples.

✓ Live

Quick Sort Algorithm: Hoare & Lomuto Partitioning Guide

Learn quick sort with Hoare and Lomuto partitioning: understand pivot selection, divide-and-conquer strategy, and achieve O(n log n) average time complexity.

✓ Live

Merge Sort Algorithm: Divide & Conquer Sorting Explained

Learn merge sort with divide-and-conquer: understand recursive splitting, merge operation, and stable O(n log n) sorting with working Python code examples.

✓ Live

Insertion Sort Algorithm: Adaptive Comparison Sorting Guide

Learn insertion sort: build sorted arrays one element at a time with O(n^2) worst-case and O(n) best-case adaptive behavior ideal for nearly sorted data.

✓ Live

Bubble Sort Algorithm: Comparison-Based Sorting Explained

Learn bubble sort with step-by-step visualization: understand pairwise comparison and swapping, optimization techniques, and when this algorithm is practical.

✓ Live

Radix Sort Algorithm: Non-Comparison Integer Sorting Guide

Learn radix sort for sorting integers in linear time: understand bucket distribution, least significant digit processing, and comparison-free sorting mechanics.

✓ Live

Linear Search Algorithm: Sequential Search Complete Guide

Learn linear search: the simplest sequential search algorithm for unsorted data with O(n) complexity, real-world applications, and optimization strategies.

✓ Live

Interpolation Search: Sorted Array Probe Search Algorithm Guide

Learn interpolation search: a binary search variant that probes based on value distribution for uniformly sorted arrays achieving O(log log n) average time.

✓ Live

Exponential Search: Unbounded Binary Search Algorithm Guide

Learn exponential search: combine exponential range finding with binary search to efficiently locate elements in unbounded and infinite sorted arrays.

✓ Live

Linked List Cycle Detection: Floyd's Tortoise & Hare Guide

Learn Floyd's cycle detection algorithm to find loops in linked lists: a classic two-pointer technique using fast and slow pointers with O(n) time O(1) space.

✓ Live

Reverse a Linked List: Iterative & Recursive Approaches Guide

Learn how to reverse a linked list using iterative and recursive approaches: master fundamental pointer manipulation for singly and doubly linked list reversal.

✓ Live

Merge Two Sorted Linked Lists: In-Place Merge Algorithm Guide

Learn how to merge two sorted linked lists in-place: a foundational pattern for merge sort, list manipulation, and efficient data structure combination.

✓ Live

Stack Using Queues: Implement LIFO with FIFO Guide

Learn to implement a stack using two queues: understand push-costly and pop-costly approaches for interview-ready LIFO behavior using queue operations.

✓ Live

Queue Using Stacks: Implement FIFO with LIFO Guide

Learn to implement a queue using two stacks: master amortized O(1) enqueue and dequeue with input and output stacks for interview-ready FIFO behavior.

✓ Live

Circular Queue: Ring Buffer Implementation Guide

Learn circular queue using arrays: understand ring buffer mechanics, front and rear pointer management, and wrap-around with modulo arithmetic for queues.

✓ Live

Monotonic Queue: Sliding Window Maximum Algorithm Guide

Learn the monotonic queue pattern for sliding window maximum: maintain decreasing order in a deque to find max elements in O(n) time for window queries.

✓ Live

Find Middle of a Linked List: Fast and Slow Pointer Guide

Learn to find the middle element of a linked list using fast and slow pointers: a critical two-pointer pattern for linked list problems and cycle detection.

✓ Live

AVL Tree: Self-Balancing BST Insertion & Rotation Guide

Learn AVL tree self-balancing with left and right rotations: maintain O(log n) height after every insertion and deletion using balance factor computation.

✓ Live

Red-Black Tree: Balanced BST Properties & Operations Guide

Learn red-black tree properties and operations: understand color constraints, rotations, and recoloring that guarantee O(log n) search, insert, and delete.

✓ Live

Segment Tree: Range Query & Point Update Algorithm Guide

Learn segment tree for range queries and point updates: build, query, and update operations in O(log n) time for array interval queries and competitive coding.

✓ Live

Fenwick Tree: Binary Indexed Tree for Prefix Sums Guide

Learn Fenwick tree for prefix sum computation: point updates and prefix queries in O(log n) time with compact array representation for competitive coding.

✓ Live

Topological Sort: Directed Acyclic Graph Ordering Guide

Learn topological sorting of directed acyclic graphs using Kahn's algorithm and DFS: produce linear orderings for task scheduling and dependency resolution.

✓ Live

Bellman-Ford Algorithm: Shortest Path with Negative Edges Guide

Learn Bellman-Ford for shortest paths with negative edge weights: detect negative cycles and find shortest paths using edge relaxation in O(VE) time complexity.

✓ Live

Floyd-Warshall Algorithm: All-Pairs Shortest Path Guide

Learn Floyd-Warshall for all-pairs shortest paths: dynamic programming for dense graphs with O(V^3) time and negative edge support for complete path analysis.

✓ Live

Minimum Spanning Tree: Prim's & Kruskal's Algorithms Guide

Learn Prim's and Kruskal's algorithms for finding minimum spanning trees: greedy approaches to connect all vertices with minimum total edge weight in graphs.

✓ Live

0/1 Knapsack Problem: Dynamic Programming Optimization Guide

Learn the 0/1 knapsack problem using dynamic programming: build DP tables for optimal subset selection with weight and value constraints in real-world problems.

✓ Live

Longest Common Subsequence: String DP Pattern Guide

Learn the longest common subsequence using dynamic programming: find the longest sequence appearing in order across two strings with DP table construction.

✓ Live

Longest Increasing Subsequence: LIS Using DP & Binary Search Guide

Learn longest increasing subsequence with O(n^2) DP and O(n log n) binary search: a classic subsequence optimization problem for coding interviews and contests.

✓ Live

Coin Change Problem: Minimum Coins & Combinations Guide

Learn the coin change problem using dynamic programming: find minimum coins for a target amount and count total combinations with unlimited coin supply.

✓ Live

Edit Distance Algorithm: Levenshtein Distance Explained

Learn the Levenshtein edit distance using dynamic programming: measure string similarity by computing minimum insert, delete, and replace operations needed.

✓ Live

Tail Recursion: Optimizing Recursive Functions Guide

Learn tail recursion optimization to prevent stack overflow: transform recursive functions with accumulator patterns into iterative equivalents for efficiency.

✓ Live

Backtracking Algorithm: N-Queens, Sudoku & Subsets Guide

Learn backtracking for constraint satisfaction: solve N-Queens, Sudoku, and subset generation using recursive trial-and-error with pruning for efficiency.

✓ Live

Subset Sum Problem: DP Partition & Combination Guide

Learn the subset sum problem using dynamic programming: determine if a subset with a given sum exists and count total subsets with target sum optimization.

✓ Live

Disjoint Set Union: Union-Find Algorithm Complete Guide

Learn disjoint set union with path compression and union by rank: implement efficient connectivity queries for graphs, Kruskal's MST, and dynamic connectivity.

✓ Live

Suffix Array: String Sorting & LCP Array Algorithm Guide

Learn suffix array construction and LCP array computation: a powerful string processing technique for substring search, pattern matching, and text analysis.

✓ Live

Bloom Filter: Probabilistic Data Structure for Fast Membership Guide

Learn bloom filter probabilistic data structure: test membership efficiently using hash functions, handling false positives without any false negatives.

✓ Live

Skip List: Probabilistic Balanced Linked List Guide

Learn skip list with probabilistic balancing: achieve O(log n) search, insert and delete with multiple linked list levels and randomized node promotion.

✓ Live

Sparse Table: Static Range Query RMQ Data Structure Guide

Learn sparse table for immutable arrays: answer range minimum queries in O(1) time with O(n log n) preprocessing using dynamic programming and binary lifting.

✓ Live

B-Tree: Balanced Tree for Database Indexing Explained

Learn B-tree data structure used in database indexing: understand balanced multi-way search trees with variable child counts and disk-based storage operations.

✓ Live

Fibonacci Heap: Decrease-Key & Merge Operations Guide

Learn Fibonacci heap for efficient priority queues: amortized O(1) decrease-key and merge operations ideal for optimizing Dijkstra's and Prim's algorithms.

✓ Live

How to Approach DSA Problems: Step-by-Step Problem Solving Guide

Learn a systematic approach to solving DSA problems: understand requirements, choose the right data structure, optimize brute force, and test edge cases.

✓ Live

Coding Interview Preparation: Complete DSA Interview Roadmap

Learn how to prepare for coding interviews: master essential data structures, algorithms, and problem-solving patterns with a structured weekly study plan.

✓ Live

Choosing the Right Data Structure: DSA Decision Framework Guide

Learn how to choose the right data structure for any problem: a decision framework comparing time complexity, space usage, and operations across all structures.

✓ Live

DSA Cheatsheet: Essential Algorithms & Data Structures Reference

Learn essential DSA concepts with this complete reference: time complexity comparisons, algorithm patterns, and structure selection for interview prep.

✓ Live

DSA Patterns for Competitive Programming: Coding Contest Guide

Learn battle-tested DSA patterns for competitive programming: master recurring algorithm templates for binary search, DP, graphs, and advanced data structures.

✓ Live

All 76 topics in Data Structures Algorithms — Complete Guide are published.