#algorithms
Recursion
Introduction Recursion is a programming technique where a function calls itself to solve a problem by breaking it down into smaller, similar subproblems. Think of Russian nesting dolls—each doll contains a smaller version of itself until you reach the smallest one that doesn’t open. Recursion is fundamental to computer science and appears in tree traversals, sorting algorithms, mathematical computations, and backtracking problems. While it can seem magical at first, understanding recursion unlocks powerful problem-solving techniques. Read more →
November 19, 2025
Depth-First Search (DFS)
Introduction Depth-First Search (DFS) is a fundamental graph traversal algorithm that explores as far as possible along each branch before backtracking. Think of it like exploring a maze by always taking the first path you see, going as deep as possible, then backtracking when you hit a dead end. DFS is essential for detecting cycles, topological sorting, finding connected components, and solving maze/puzzle problems. Unlike BFS which uses a queue, DFS uses a stack (or recursion, which implicitly uses the call stack). Read more →
November 19, 2025
Breadth-First Search (BFS)
Introduction Breadth-First Search (BFS) is a fundamental graph traversal algorithm that explores vertices level by level, visiting all neighbors of a vertex before moving to the next level. Think of it like ripples spreading out in water—you explore all vertices at distance 1, then distance 2, and so on. BFS is essential for finding shortest paths in unweighted graphs, level-order traversal of trees, and solving maze/puzzle problems. It uses a queue to maintain the order of exploration. Read more →
November 19, 2025
Graphs - Introduction
Introduction A graph is a non-linear data structure consisting of vertices (nodes) connected by edges. Unlike trees, graphs can have cycles, multiple paths between nodes, and connections in any direction. Graphs model relationships and networks, making them fundamental to solving real-world problems in social networks, maps, computer networks, and more. Graphs are one of the most versatile and powerful data structures in computer science. By the end of this tutorial, you’ll understand graph terminology, types of graphs, representation methods, and when to use them. Read more →
November 19, 2025
Heaps and Priority Queues
Introduction A heap is a specialized tree-based data structure that satisfies the heap property: in a max-heap, parent nodes are always greater than or equal to their children; in a min-heap, parent nodes are always less than or equal to their children. Heaps are the foundation for priority queues and enable efficient algorithms like heap sort and finding the kth largest element. Unlike Binary Search Trees, heaps don’t maintain a fully sorted order—they only guarantee the min/max element is at the root. Read more →
November 19, 2025
Binary Search Trees (BST)
Introduction A Binary Search Tree (BST) is a specialized binary tree with an important ordering property: for every node, all values in the left subtree are less than the node’s value, and all values in the right subtree are greater. This simple property enables efficient searching, insertion, and deletion operations. BSTs are one of the most important data structures in computer science, forming the basis for efficient ordered collections, database indexing, and many algorithmic solutions. Read more →
November 19, 2025
Binary Trees
Introduction A binary tree is a hierarchical data structure where each node has at most two children, referred to as the left child and right child. Unlike linear data structures like arrays or linked lists, binary trees organize data in a hierarchical, branching structure that enables efficient searching, sorting, and hierarchical representation. Binary trees are fundamental to computer science and appear in file systems, databases, compilers, and countless algorithms. By the end of this tutorial, you’ll understand different types of binary trees, how to traverse them, and when to use them. Read more →
November 19, 2025
Circular Queues
Introduction A circular queue (also called a ring buffer) is a linear data structure that uses a fixed-size array in a circular manner. Unlike a regular queue where dequeued elements leave wasted space at the front, a circular queue reuses that space by wrapping around to the beginning when reaching the end of the array. Think of it like a circular track where runners keep going around—when you reach the end, you simply continue from the start. Read more →
November 19, 2025
Deques (Double-Ended Queues)
Introduction A deque (pronounced “deck”) is short for “double-ended queue”—a linear data structure that allows insertion and deletion at both the front and the rear. Think of it as a hybrid between a stack and a queue, offering the flexibility to add or remove elements from either end. This versatility makes deques powerful for problems requiring sliding windows, palindrome checking, and maintaining ordered sequences with efficient operations at both ends. By the end of this tutorial, you’ll understand when deques shine and how to implement them efficiently. Read more →
November 19, 2025
Queues
Introduction A queue is a linear data structure that follows the First-In-First-Out (FIFO) principle. Think of it like a line at a coffee shop: the first person to join the line is the first person to be served. This fair ordering makes queues perfect for managing tasks, requests, and data that needs to be processed in the order it arrives. Queues are everywhere in computing—from managing print jobs and handling network requests to implementing breadth-first search algorithms. Read more →
November 19, 2025
Stacks
Introduction A stack is a linear data structure that follows the Last-In-First-Out (LIFO) principle. Think of it like a stack of plates: you can only add or remove plates from the top. The last plate you place on the stack is the first one you’ll take off. Stacks are fundamental in computer science and appear everywhere—from the call stack that tracks function calls in your program to undo/redo functionality in text editors. Read more →
November 19, 2025
Linked Lists
Introduction A linked list is a linear data structure made of nodes where each node stores a value and a reference (a “link”) to the next node. Unlike arrays, linked lists do not store elements contiguously in memory. This gives them different performance characteristics and trade-offs. If you are new to time and space complexity, start with our guide to Big-O Notation. You may also want to review Arrays to understand how linked lists compare. Read more →
November 18, 2025
Binary Search
Introduction Binary search is a classic algorithm used to quickly find the position of a target value within a sorted collection. It repeatedly divides the search interval in half, discarding the half that cannot contain the target. Because of this halving behavior, binary search runs in logarithmic time: O(log n). If you are new to complexity analysis, review our guide to Big-O Notation. Also see our overview of Arrays, since binary search is most commonly applied to sorted arrays. Read more →
November 18, 2025
Data Structures
Master fundamental data structures and algorithms. From arrays and linked lists to trees and graphs. Read more →
September 11, 2023