A free, self-paced textbook in 7 chapters. Read a chapter, then drill it with the 221 companion flashcards using spaced repetition.
A data structure is a particular way of organizing data in a computer so that it can be used effectively, while an algorithm is a step-by-step procedure that defines a set of instr...
A binary tree is a tree data structure in which each node has at most two children, referred to as the left and right child. A binary search tree (BST) imposes an ordering constrai...
A hash table stores data in an associative manner, arranging values in an array format where each data value has its own unique index. Hashing is the process of converting a given...
A graph is a non-linear data structure consisting of nodes, also called vertices, and edges that connect pairs of vertices. Two principal ways exist to represent a finite graph in...
Searching is one of the most fundamental algorithmic tasks. Linear search examines every item one by one, giving a time complexity of \(O(n)\). Binary search repeatedly divides a s...
Several recurring paradigms underlie the design of efficient algorithms. Recursion is the process in which a function calls itself as a subroutine, while iteration uses a loop to r...
String matching is a deep subfield with its own family of algorithms. The Knuth-Morris-Pratt algorithm searches for occurrences of a word W within a text S by exploiting the struct...