Finite-prefix extension of a big O bound Created 2026-10-25 Updated 2026-10-31
Let , with everywhere. An eventual bound can be made valid for all natural numbers by enlarging to the maximum of itself and the finitely many ratios before its cutoff. Conversely, a global bound is an eventual bound. Nonvanishing on the finite prefix is essential: , , and for give an eventual bound but no global one. The useful principle is that finitely many finite ratios cannot destroy a big O notation.
Let be fixed real symmetric matrices, with , , and a simple eigenvalue. Complete to an orthonormal eigenbasis with eigenvalues . Put and . Then . The symmetric eigenvalue residual bound produces an eigenvalue in Big O notation.
Fundamental strip of a Mellin transform 2026-10-14
The fundamental strip of a Mellin transform is the interior of the set of real parts for whichViewed in the complex plane, it is a vertical strip ; either bound may be infinite, and the interior may be empty. Both endpoints of the improper integral must be checked. Convergence on a boundary line, whether absolute convergence or conditional convergence, requires a separate test. The Mellin transform is holomorphic throughout a nonempty fundamental strip.[ref]
NIST Digital Library of Mathematical Functions. Chapter 2, §2.5(i), equation 2.5.1 and the following description of the vertical domain of analyticity
A practical sufficient test uses Big O notation: if near zero and near infinity, with real , then comparison with elementary improper integrals givesThus guarantees absolute convergence. These upper bounds on need not locate the maximal Mellin fundamental strip; faster actual decay can widen it. The strip property itself follows by bounding the weight at any intermediate by the sum of two weights already known to be integrable. On a closed narrower strip, neighboring integrable weights also dominate the natural logarithm factors introduced by differentiation under the integral sign, making the transform a holomorphic function.
An exact two-endpoint example isHere both bounds are sharp: at the zero-end absolute convergence test contains , and at the infinity-end test contains . The displayed rational function continues meromorphically outside the Mellin fundamental strip and has simple poles at and . Its other finite continued values outside the strip are values of a meromorphic continuation, not of a convergent defining integral. More general endpoint information leads to meromorphic continuation of a Mellin transform from an asymptotic expansion.
Two endpoint conditions define the Mellin fundamental strip
. Left: the Mellin fundamental strip for below one and above one is . Crosses mark the two poles of the continued rational function, not whole lines of isolated singularities. Right: the formula and independently computed integrals agree on the real slice inside the strip. The curve is drawn only where the defining integral converges. Details. Gale-Shapley algorithm Created 2026-10-14 Updated 2026-10-18
The Gale-Shapley algorithm constructs a stable matching by letting one side propose and the other hold its best offer so far. The word "deferred" is essential: a held proposal is tentative and can be replaced. David Gale and Lloyd Shapley presented this construction in their 1962 paper, College Admissions and the Stability of Marriage, §3, printed pp. 12–13; §4 extends it to college quotas and unacceptable pairs.
For the one-partner bipartite graph model, designate as proposers and as receivers:
- Start with the empty matching in a graph. Each proposer keeps a pointer to its first untried acceptable partner.
- Choose an unmatched vertex in a matching whose list is not exhausted. It proposes to its highest-ranked untried neighbour of a vertex and advances its pointer permanently.
- If holds nobody, it holds . Otherwise compares with its currently held proposer, keeps the one it prefers, and rejects the other. A displaced proposer becomes unmatched and may propose again later.
- Stop when every unmatched proposer has exhausted its list. The held pairs are the output matching in a graph.
Held proposers wait; only unmatched proposers act. A receiver can replace its held partner, whereas a proposer never tries the same edge twice. Isolated vertices simply remain unmatched. These rules also describe incomplete acceptable lists and unequal sides without adding fictitious acceptable partners.
For the preference lists under stable matching, choose available proposers in queue data structure order, initially , adding rejected proposers at the end. The proposals are , , , , . At the fourth proposal, replaces its held by because . This frees to try , producing .
Five proposals in the Gale-Shapley algorithm: Y replaces a tentative partner before the final stable matching
. Details. Reverse the proposing side. Starting in the order , the proposals are , , , . Now rejects because it already holds . The result is . Thus the choice of proposing side can change the output even with strict preferences and complete lists.
Why does the procedure work? Each edge receives at most one proposal, so at most proposals occur. At all times, the held edges form a matching in a graph, and each receiver holds its favourite proposer among all proposals received. A receiver's held partner can only improve according to its strict preference. If a proposer prefers to its final partner, or ends unmatched while is acceptable, it must already have proposed to . A rejection means then held someone better, and its final partner is at least as good. Such an edge cannot be a blocking pair in stable matching. This covers every possible blocking pair in stable matching, proving stability at termination.
With a queue data structure of unmatched proposers, a next-choice pointer for each list, and constant-time receiver-rank lookups, each proposal takes constant work. Using Big O notation, the time complexity is including initialization, provided list construction and rank preprocessing also take . Edge-indexed ranks with cross-referenced list entries, or expected constant-time hash lookups, allow sparse storage proportional to . Repeatedly scanning a receiver's preference list to compare offers would lose this bound. For complete lists with vertices per side, and the bound is . Initializing full rank tables itself costs time and space, even when only a sparse set of pairs is acceptable.
The Gale-Shapley algorithm does more than establish existence: with strict preferences, its output is a proposer-optimal stable matching.[ref]
College Admissions and the Stability of Marriage by David Gale and Lloyd Shapley. §5, printed p. 14, Theorem 2: applicant optimality and the rejection induction
It is also a receiver-pessimal stable matching, as proved below. Both qualifications compare partners across stable matchings. Gaussian elimination Created 2026-09-24 Updated 2026-10-25
Gaussian elimination applies elementary row operations to reduce a linear system to triangular form. Dense elimination uses arithmetic operations.
Gaussian elimination solves a linear system by removing one unknown from later equations at each step. Write the coefficients and right-hand side together as an augmented matrix . Apply the same elementary row operations to both parts until the coefficients form a row echelon form; for a square invertible matrix, this gives an upper triangular matrix system. Then back substitution recovers the unknowns from the last equation upward. The useful simplification is that each successive equation involves fewer unknowns, while the set of solutions stays the same.
Why do elementary row operations preserve solutions? Interchanging equations changes only their order. Multiplying an equation by a nonzero scalar can be undone by division. Replacing equation by itself plus times equation , with , can be undone by adding times the unchanged equation . Equivalently, an elementary matrix is an invertible matrix, so if and only if . Applying an operation to without also applying it to loses this equivalence.
At step , choose a nonzero pivot element after any row interchange. For every , form the elimination multiplier and perform the elementary row operation . Its coefficient in column becomes in exact arithmetic. Later operations combine rows that already have zeros in earlier columns, so those zeros survive. If an active column has no nonzero candidate, general row echelon form reduction skips it; a square invertible matrix always has a candidate at each step with suitable row interchanges. Partial pivoting also considers roundoff error when selecting the candidate.[ref]
2.6 Row pivoting. Fundamentals of Numerical Computation by Tobin A. Driscoll and others; §2.6.1, Definition 2.6.1: select the largest absolute candidate; §2.6.3: permute the right-hand side too
For a dense matrix with one right-hand side, the classical algorithm uses arithmetic operations over the real numbers, counting each addition, subtraction, multiplication and division as one. At step , the coefficient update has entries, each costing one multiplication and one subtraction; the elimination multipliers, right-hand-side updates and back substitution contribute lower-order terms. Searching for partial pivoting adds comparisons, and storing the dense coefficients uses space. These assumptions exclude the different storage and work patterns of sparse Gaussian elimination; the exact loop counts appear in LU factorization and solve costs. Here denotes Big O notation.
Recording the same steps as an LU decomposition makes Reusing LU factors for multiple right-hand sides possible. This is useful whenever the coefficients stay fixed while the forcing vector changes: the expensive elimination is done once. The choice of pivot element matters even when the linear system is well conditioned, as Tiny-pivot roundoff in Gaussian elimination demonstrates.
Gaussian peak behind Stirling's formula 2026-10-14
Repeated integration by parts gives the Gamma integralThe logarithm of its integrand is , whose unique maximum is at . Write . For fixed and large , a Taylor expansion givesThe Big O notation here is for a fixed , or uniformly for in a fixed bounded interval. It does not claim a uniform approximation over the entire growing integration domain. Consequently the peak, divided by its height, approaches .
The exact substitution givesReplacing the integral by the Gaussian integral produces . Thus the estimate is peak height times width times the area of a standard Gaussian peak. This is Laplace's method in a concrete form; controlling the integral's tails justifies the replacement. The next terms, including their products after exponentiation, produce the Stirling correction by Gaussian moments.
Hash table resizing Created 2026-10-13 Updated 2026-10-18
Changing the number of hash buckets and reassigning stored records using the new bucket-index hash function. Amortized analysis of rebuilding and expected value bounds for subsequent lookup address different costs.
Rebuild the balanced example from load factor of a hash table with while keeping exactly the same twelve records. Under , keys retain their indices, whereas keys move from hash buckets to hash buckets . The new chain lengths are twelve ones followed by four zeros; . Copying the old eight chain heads and adding eight empty heads would leave those four moved keys unreachable by the new lookup rule.
Hash table resizing from eight to sixteen hash buckets redistributes existing records
. Original modular arithmetic example for keys . Blue keys keep their indices; orange keys move because differs from . The record count stays twelve, and empty hash buckets still count towards capacity. Details.For a short algorithm correctness outline, allocate the new array, visit every old record once, compute its new bucket index, and link it into that hash bucket. At every step, each transferred record is stored exactly once at the index prescribed by the new hash function. Finishing the visit therefore preserves every key-value association and makes the new lookup rule valid. Direct transfer can skip duplicate searches because the old one-value-per-key map already established distinct equivalence classes; rebuilding is not twelve new user insertions.
Under constant-cost hashing, linking and slot initialization, separate chaining rebuilding takes time complexity: initialize new heads, examine old heads, and transfer records. For doubling, , this is in Big O notation. It is when the resize policy makes proportional to , but an enormous mostly empty old array can make scanning its heads dominate. Growing capacity can lower without shortening a particular chain: the concentrated keys all remain in hash bucket after growth from eight to sixteen.
For an insertion-only sequence starting empty, choose initial capacity and double before a genuinely new key would make . The first three growths occur before inserting records and transfer existing records. If distinct records are inserted, the transfer count is . More generally, the transferred old capacities form a geometric series; if the last is , their sum is . Initializing and scanning these geometrically growing arrays also costs in total, giving amortized rebuilding overhead per insertion. A triggering insertion still pays for its whole rebuild.[ref]
Lecture 9: Hashing II. 6.006 Introduction to Algorithms, Fall 2011 by Massachusetts Institute of Technology, 6.006 course staff; p. 2, Rehashing, How fast to grow?, and Amortized Analysis
The illustrative twelve-record resize above is an explicitly requested rebuild, not a growth triggered by this threshold policy. Checking for an equal key before growing also prevents a value replacement from triggering unnecessary growth. To combine resizing overhead with expected constant insertion time complexity, separately impose the collision and constant-cost assumptions in load factor of a hash table. Amortized analysis distributes rebuilding costs over operations; it does not randomize a poor hash function or bound a single operation's latency. With deletions, separate the grow and shrink thresholds; for example, growing when full and halving at one-quarter live occupancy leaves room for many operations between opposite rebuilds.[ref]
Lecture 9: Hashing II. 6.006 Introduction to Algorithms, Fall 2011 by Massachusetts Institute of Technology, 6.006 course staff; p. 3, Back to Hashing and Delete: halving when n reaches m/4
// Target: computer-science.bigb
Insertion sort 2026-10-13
Insertion sort grows a sorted prefix of an array one entry at a time. In the adjacent-swap version, start with position , compare its current sort key with the preceding sort key, and swap the complete sorting records only when the right sort key is strictly smaller. Continue leftward until no swap is needed or the entry reaches position zero; then process original position . A tie stops the pass. This is the strict comparison and exchange rule in the authored implementation.[ref]
Take , where the subscript labels a complete sorting record and comparisons inspect only its sort key. Starting from index zero, the complete key-comparison trace is:
The loop invariant is that, before pass , positions satisfy sortedness and contain precisely the entries originally in that prefix. Moving the next entry left through strictly larger sort keys extends that prefix, and every swap retains sorting permutation preservation. Equal-key entries never cross, giving stable sorting. Each leftward step decreases the position, and each completed pass increases the prefix length, so the algorithm terminates.
With constant-cost key comparisons and swaps, reverse-ordered distinct sort keys cause comparisons and swaps. Thus worst-case time complexity is in Big O notation. An already sorted array needs only key comparisons for and no swaps. The adjacent-swap version uses constant auxiliary space complexity. Small or nearly sorted arrays can therefore make insertion sort useful despite its quadratic worst case.
Interval scheduling 2026-10-18
Given a finite set of jobs with fixed half-open intervals , where , choose a subset of maximum cardinality. Each job occupies one shared resource throughout its interval. A feasible solution has pairwise disjoint intervals: for distinct selected jobs , either or . Thus a finish and the next start may coincide. Every job has value one; occupied time is not the objective function.[ref]
Lecture 1: Introduction. 6.046J Design and Analysis of Algorithms, Spring 2015; Printed p. 2, Interval Scheduling: fixed requests, one resource, compatibility with endpoint equality, maximum size
Consider these six original jobs, with arbitrary time units:Job can be followed immediately by and . Job conflicts with all three. Starting the resource earlier is therefore not automatically beneficial: one long commitment can displace several shorter requests.
The earliest-finish greedy algorithm uses a sorting algorithm to put jobs in nondecreasing finish time. Scan that order, accepting the first job and then each job whose start is at least the last accepted finish. Break finish-time ties arbitrarily; an empty input returns the empty set. For these jobs, the order and decisions areAfter , job starts before the current finish five and is rejected. Accept ; then reject because six is before seven. Finally accept . The result is , with cardinality four. Leaving idle makes room for more jobs.
By contrast, the earliest-start rule scans . It accepts , skips , accepts , and skips . Its feasible solution contains only two jobs. Here and meet at time six and are compatible; and overlap on .
Earliest finish accepts four jobs; earliest start accepts two
. The same six original intervals appear in both panels. Colored jobs are accepted and gray jobs rejected. A filled start and hollow finish depict a half-open interval; jobs meeting at an endpoint are compatible. Details.There is also an elementary optimality certificate for this example. The four subsets , , and form a partition of a set of the jobs. A feasible solution takes at most one job from each group: overlap, as do , and each other group is a singleton. Hence four is an upper bound, attained by . Checking all subsets gives a unique optimum of size four: .
The earliest-finish theorem states that this greedy algorithm maximizes job count for every finite instance of interval scheduling. For the exchange argument, let be the first job in an optimal feasible solution and an earliest-finishing job. Every later selected job satisfiesReplace by ; compatibility and cardinality survive. The remainder must be optimal among jobs starting at or after , or improving it would improve the whole selection. Mathematical induction on the smaller remaining instance, starting with the empty set, completes the outline.[ref]
Greedy Algorithms. Algorithms by Jeff Erickson; §4.2 Scheduling Classes, Lemma 4.3 and Theorem 4.4, printed pp. 163–164; endpoint equality is allowed by our half-open convention
Why is the algorithm fast? Once sorted, each job is examined once, using only the last accepted finish to decide compatibility. The scan takes time; comparison sorting algorithms give total time complexity for , in Big O notation, assuming constant-cost endpoint comparisons. Already sorted input needs only the scan.[ref]
Lecture 1: Introduction. 6.046J Design and Analysis of Algorithms, Spring 2015; Printed pp. 2–4, earliest-finish rule, compatibility and first-job exchange; scan cost follows by counting one comparison per subsequent request
Jackknife bias correction Created 2026-09-24 Updated 2026-10-14
The jackknife bias correction uses jackknife resampling to estimate and subtract the bias of an estimator. Here denotes the original estimator, its version after deleting observation , and the mean of those versions. For sample size , defineThe sign matters: a negative estimated bias increases the corrected value. The original estimator and all deletion versions must target the same estimand and use the same estimation rule at their respective sample sizes. The definition alone does not make an unbiased estimator.
For an exact worked example, take the empirical varianceOn , the sample mean is and . Each deletion empirical variance is recomputed around its own deletion sample mean, with divisor , givingFor instance, deleting leaves , whose sample mean is and whose empirical variance is . The correction on the full statistical sample isThe same data thus give a jackknife variance estimator of for the sample mean, and a corrected empirical variance of ; these are different estimands.
The exact equality with the usual sample variance is not an accident of these numbers. For any data with , write . Removing changes this sum to , soFor independent and identically distributed random variables with finite second moment and population variance , the expectation is . Its bias is exactly ; jackknife bias correction removes it exactly in this example. Thus is an unbiased estimator of under these assumptions, including where each deletion empirical variance is zero.
More generally, suppose the bias has a regular expansion at both sample sizes and , with coefficients independent of :Under independent and identically distributed sampling, each deletion estimator has the same expectation as . Hence the corrected bias isThe leading term cancels; the remaining bias need not vanish. The notation is big O notation. This argument presumes the expansion, rather than proving it for every statistic; the regularity conditions discussed for the jackknife variance estimator and statistical dependence still require care. Shalizi's [ref] develop the cancellation argument and cite Quenouille's [ref]
https://academic.oup.com/biomet/article-abstract/43/3-4/353/345190. Notes on Bias in Estimation, Biometrika 43(3–4), 353–360 (1956)
. Kahn's algorithm 2026-10-14
Kahn's algorithm maintains each remaining vertex's indegree, the number of its unfinished incoming directed edges, and a FIFO queue of ready vertices. Initialize the counts by scanning all directed edges and enqueue every vertex of indegree zero. Repeatedly dequeue a vertex , append it to the output, and decrement the count of each destination in 's adjacency list. Enqueue exactly when its count becomes zero. When the FIFO queue empties, accept the output if it contains all vertices; otherwise report a directed cycle. [ref]
https://raw.githubusercontent.com/kevin-wayne/algs4/master/src/main/java/edu/princeton/cs/algs4/TopologicalX.java. Sedgewick and Wayne, TopologicalX: queue-based topological sorting
Computed ready-queue trace and the obstruction caused by a reverse dependency
. Details. In the displayed run, initialize the FIFO queue as and visit 's destinations in the order . Removing makes ready but leaves waiting for . Removing then makes ready. Publication becomes ready only after both and are removed. The output is ; choosing ready vertices differently can produce the other topological orders. For the modified directed graph with , the same procedure emits and then stops with still waiting on each other.
The invariant is that each stored indegree counts incoming directed edges from unprocessed vertices. A ready vertex therefore has every prerequisite already in the output. If the FIFO queue empties with vertices left, every remaining vertex has a predecessor in the remaining directed graph; the predecessor argument gives a directed cycle. The unprocessed vertices can also include tasks blocked downstream of a directed cycle, so the leftover list alone is not a list of exactly the cyclic vertices.
With adjacency lists, constant-time array access and counter updates, and constant-time FIFO queue operations, the time complexity is in Big O notation. Initialization scans all vertices and directed edges; each vertex is then enqueued at most once and each outgoing directed edge processed at most once. Counts, ready FIFO queue, and output need storage beyond the adjacency lists. Shifting an array on every dequeue invalidates this bound. [ref]
https://raw.githubusercontent.com/kevin-wayne/algs4/master/src/main/java/edu/princeton/cs/algs4/TopologicalX.java. Sedgewick and Wayne, TopologicalX: time and extra-space bounds
[ref]https://raw.githubusercontent.com/kevin-wayne/algs4/master/src/main/java/edu/princeton/cs/algs4/Digraph.java. Sedgewick and Wayne, Digraph: adjacency lists and outgoing-edge iteration
The name refers to A. B. Kahn's 1962 paper "Topological sorting of large networks", published in Communications of the ACM, volume 5, issue 11, pages 558–562. Its abstract motivates topological sorting through network analysis and project planning. [ref]
https://doi.org/10.1145/368996.369025. Kahn, Topological sorting of large networks (1962): publisher's record and abstract
// Target: foundations-of-mathematics.bigb
Karatsuba digit-operation cost 2026-10-13
Count a fixed-base digit addition, subtraction, digit copy, or single-digit multiplication as constant cost. Base stays fixed as grows; an entire arbitrary-length integer multiplication is not one constant-cost step. With this model, splitting, sum formation, shifts and recombination require digit operations. Ordinary digit-by-digit multiplication forms digit products for two -position operands. The GMP base-case description uses this rectangular product arrangement.[ref]
Basecase Multiplication. GNU MP 6.3.0 manual, §15.1.1 Basecase Multiplication: rectangular cross-products and O(NM) cost
The ideal equal-half recurrence relation isFor , level has calls of size . If each internal call incurs exactly times its size in additional digit work, that level contributes . There are leaves. The geometric series of internal work isThus fixed positive leaf cost plus this internal work grows on the order of . In Big O notation, . Removing one of four products at every level matters much more than saving just one at the root.
Karatsuba recursion levels and an explicitly stipulated cost comparison
. Left: the ideal equal-half recursion for , with three children per internal call. Right: model counts for , one unit per leaf and internal overhead for size with . The resulting count is , compared with ordinary digit products. This illustrates the recurrence relation; its constants and crossover are stipulated, rather than measured execution times. Details.The literal sum-based implementation instead admits the upper boundfor a nondecreasing worst-case cost envelope above a fixed base-case threshold. The extra digit does not change the exponent: since , subtracting three from the size makes each child's adjusted size at most half its parent's. Stop this comparison at any fixed threshold greater than three; its recursion depth is and the level-work sum is bounded by the same geometric series up to constant factors. Exact call counts can depend on carries, zero shortcuts and the threshold, so they need not equal the ideal at each depth.
Kruskal component merging 2026-10-18
A disjoint-set data structure stores the current partition of a set of vertices into connected components of a graph. The operation returns a representative of the block containing . Two vertices are in the same block exactly when their representatives agree. For each candidate edge , compare and . Equal representatives mean reject; different representatives mean accept and perform , merging the two blocks. The representatives are bookkeeping choices, not preferred vertices of the minimum spanning tree.
Connected components of a graph merge only when an edge is accepted
. The same example as a disjoint-set data structure ledger. Each coloured band is one block of the current partition of a set. The rejection of leaves both the partition of a set and the running cost unchanged. Bands show membership, not internal representative pointers. Details.Every acceptance reduces the connected component of a graph count by one and increases the accepted edge count by one, preserving . Thus the ledger reaches exactly when . Only ten representative queries and four merges are needed for the five examined edges, counting two queries per examination and using the already found representatives for each merge. Neither breadth-first search nor reconstruction of a graph path is needed for these connectivity queries.
For and , comparison sorting algorithm takes time for , using Big O notation. One simple disjoint-set data structure implementation stores each block as a rooted tree and attaches the smaller block's root below the larger block's root. Whenever a vertex's depth increases, its block size at least doubles, so its depth is at most . Consequently each representative query or merge takes time. Initialization plus the scan costs ; including sorting algorithm gives , hence for a connected input with . These are operation bounds, not measured timings.[ref]
WeightedQuickUnionUF.java. Robert Sedgewick and Kevin Wayne, Algorithms, 4th edition, companion WeightedQuickUnionUF.java: class documentation and union method; union by size without path compression, linear initialization and logarithmic operations
Leading Taylor term Created 2026-09-24 Updated 2026-10-14
Suppose an analytic function near is not identically zero there. Its Taylor series has a first nonzero coefficient , andThe term is its leading Taylor term. Dividing by gives a limit of as , so this term determines the leading local magnitude and angular behaviour. The remainder uses big O notation; it is smaller by one power near the centre.
For a real-valued analytic function of a real variable, an even integer gives the same nearby sign on both sides of , while an odd integer gives opposite signs. For example, has leading Taylor term and is positive on both sides of zero sufficiently nearby; has leading Taylor term and changes sign there. The finite factor stays positive for . The ordinary constant term is the leading one when .
Let be the Cesàro mean of a sequence. If for every positive integer , the triangle inequality gives . Mathematical induction repeats this estimate with the same constant for every iterate. An eventual bound can be made global by increasing to absorb the finitely many initial terms. Consequently iterated Cesàro means preserve linear growth in Big O notation; this bound alone does not assert convergence or summability.
Linear probing cluster 2026-10-18
A maximal consecutive run of occupied or deleted slots in linear probing, bounded by never-used slots when any exist; adjacency wraps around by modular arithmetic. Deleted slots still belong to the search run.[ref]
5.2 LinearHashTable: Linear Probing. Open Data Structures: An Introduction by Pat Morin; Section 5.2.1, definition of a run using non-nil entries and modular indices
In the eight-slot example, array indices form one linear probing cluster. Inserting absent hash table key starts at , passes the occupied slots , and fills . This extends the same linear probing cluster despite having a different initial array index from . A hash collision at the initial slot is enough to make later slots compete too.
For a worst-case family, insert integer hash table keys into an empty capacity- array, using the hash function , where . They occupy array indices . Lookup of absent needs hash table probes. Taking gives hash table load factor at most while the number of hash table probes grows with . Thus occupancy alone cannot promise constant lookup work.
Before any rebuilding, bounded lookup, deletion by hash table key, and insertion with a duplicate check each have worst-case time complexity in Big O notation, assuming constant-cost hash function evaluation, array access and key equality. The counterexample gives a matching linear worst-case growth in the number of hash table probes. Hash table resizing is additional work; expensive string comparisons or hashing also fall outside these constant-cost assumptions.
Linear search comparison count 2026-10-14
Count just the equality tests between the target and an entry, excluding loop conditions and index updates. If the first match is at index , linear search uses exactly equality tests. If the target is absent, it uses exactly . Thus for the best successful case costs one equality test, and the worst case costs , attained by absence or a first match at the last index. For , the sole outcome is absence with .
An expected value needs a specified probability distribution. For , condition on success, assume the target occurs exactly once, and assume its position has a uniform distribution on a finite set of indices . Then the expected value of the linear search comparison count isThis is the average of the costs under those assumptions, with no assumption that the array is sorted. It is not a universal average for arbitrary queries. For example, with , a unique successful target at index with probability and at index with probability has expected value , rather than .
Duplicates also require care about what is sampled. Choose a position uniformly in , then search for its value. All queries succeed, but the five possible sampled positions give costs : both positions holding cause an immediate match at index . The expected value is , not . Uniformly choosing an occurrence does not uniformly locate the first match.
More generally, let the success probability be and let be the conditional probability that the first matching index is , allowing duplicates. Since , the expected value isUnder the unique, uniformly located successful-target assumptions this becomes . If every query is absent, and without needing conditional probabilities. When , success is impossible and ; the successful-search conditional formula is undefined.
Converting the linear search comparison count to execution time needs a cost model. Under constant-cost equality tests, next-entry access, and loop bookkeeping, worst-case time complexity is in Big O notation for , with constant overhead even for the empty sequence. Variable-length entries can make an equality test expensive. On a linked list, advance along its links; repeatedly restarting at the head to obtain the next numeric index adds work that the comparison count does not capture. These are exact operation counts and conditional mathematical averages, not runtime measurements.
Linked list 2026-10-13
A data structure representing a sequence through linked list nodes and links between them. In the singly linked representation used here, each linked list node holds an item and a
next reference to its successor. head identifies the first linked list node; the final next is null, meaning no successor. An empty linked list has head = null. Sedgewick and Wayne use this representation to implement both a stack and a FIFO queue. [ref]https://algs4.cs.princeton.edu/13stacks/index.php. Sedgewick and Wayne, Algorithms, section 1.3: linked lists
For , place the linked list nodes at conceptual computer memory positions , respectively. These deliberately separated labels describe a toy layout, not actual pointer values. The sequence order comes from the links, not increasing positions. To read index , begin at
head and follow two next references. For index , this takes link-following steps and time complexity, hence in the worst case for linked list nodes, under the constant-cost operations assumed for the array example. [ref]https://opendatastructures.org/ods-java/3_Linked_Lists.html. Pat Morin, Open Data Structures, chapter 3: links versus indexed access
Suppose a reference to the existing linked list node is already known. To insert a fresh linked list node after it, first set
X.next = B.next, preserving the old successor , and then set B.next = X. The result is ; none of the old items moves. Reversing these assignments would read the newly changed B.next and set X.next = X, losing the route to from head. This is a two-update algorithm correctness argument, rather than a claim that finding the insertion location is free.The two pointer updates take time in Big O notation. The complete insertion has time complexity if the predecessor is already known, allocating and initializing the fixed-size linked list node costs , and copying its item has constant cost. Finding from
head can instead cost ; a position described only by an index does not confer the constant-cost advantage. This makes a linked list useful when an algorithm already holds the needed linked list node, or repeatedly works at the front as a stack does.Deletion similarly needs the incoming link: to remove after known , set
B.next = X.next. A reference to alone does not identify its predecessor in this singly linked representation. The head is a special case: after checking for a nonempty linked list, remove it with head = head.next. If a tail reference is also maintained, deleting the only linked list node must clear that reference too; a stored length must also be updated. Removing a linked list node from the sequence and reclaiming its storage are separate responsibilities. [ref]https://opendatastructures.org/ods-java/3_1_SLList_Singly_Linked_Li.html. Pat Morin, Open Data Structures, section 3.1: head removal and empty-list bookkeeping
There are practical costs beyond Big O notation. Each singly linked linked list node needs a successor reference in addition to its item; separate allocation may add further overhead, while an array can reserve unused capacity. Consecutive array slots can make a scan reuse nearby contents already brought into a memory cache; separated linked list nodes can make link following wait for successive computer memory fetches. These are layout-dependent effects, not a guarantee that every array operation beats every linked list operation on every machine. An array of references can still lead to scattered objects, and linked list nodes can be allocated close together. [ref]
https://people.freebsd.org/~lstewart/articles/cpumemory.pdf. Ulrich Drepper, What Every Programmer Should Know About Memory, sections 3.3 and 6.2: access patterns and cache use
Lipschitz one-step error bound 2026-10-31
Suppose the increment function of a one-step method is Lipschitz continuous in its solution argument with constant , uniformly in time and step size. Let be the global error, and let be the exact-start local truncation error. The triangle inequality gives . Iterating and summing a geometric series proves the displayed estimate. Since , uniformly bounded and consistency error give global error on a fixed time interval when . Here denotes Big O notation. This is a constant-step form of the discrete Gronwall inequality.
Little o notation Created 2026-10-14 Updated 2026-10-25
When is nonzero sufficiently near the specified limit, little o notation meansThus the numerator becomes negligible relative to the denominator's scale. As , because ; as , because . The direction of the limit changes the comparison. [ref]
Equivalently, for every , the bound holds sufficiently near that limit, with a threshold allowed to depend on . Big O notation needs only one fixed multiplier, making it weaker. For example, but is not . The useful relation turns asymptotic equivalence into a statement about a negligible remainder.











