brain
tamnd's digital brain — notes, problems, research
41800 notes
Consider the task of placing $N$ points in the plane such that the distance between any two points $M_i$ and $M_j$ is a given number $r_{ij}$.
The desired inequality can be rewritten as
Denote the sides opposite $A_1,A_2,A_3$ by
Let points $A$ and $B$ be fixed on the plane, and let $C$ lie on the perpendicular bisector of segment $AB$, since it must satisfy $|AC| = |BC|$.
Let
For the first part, the numbers involved are all two-digit numbers, so each number can be represented as an ordered pair $(a,b)$ with $a,b \in {1,2,\dots,9,0}$, $a\neq 0$.
Consider a lion moving along a polygonal path inside a circular arena of radius $R = 10$ meters.
Consider a small case to understand the process.
Consider the equation $n^x + n^y = n^z$ in natural numbers.
Let the side length of the equilateral pentagon be $1$, and let its consecutive vertices be $A_1,A_2,A_3,A_4,A_5$.
Consider small values of $n$ first.
Place the square in the coordinate plane with vertices
Consider a die with faces numbered so that opposite faces sum to $7$.
Perfect numbers are rare and highly structured.
Consider an arbitrary compact planar blot.
The problem concerns a king moving on an $8\times 8$ chessboard, visiting every square exactly once, and returning to the starting square.
We are asked to compare the square of a sum of five positive numbers with four times a sum of specific pairwise products taken cyclically.
Consider first a triangle, the simplest convex polygon.
Consider a small patch of the grid with just one black cell at $(0,0)$.
Let the circle have center $I$.
We are asked whether an expert can convince the court, using only three weighings on a balance scale, that exactly seven out of fourteen coins are counterfeit.
The operation does not act on individual digits.
Let
Consider the problem geometrically by placing triangle $A_1 A_2 A_3$ in the plane and attempting to construct a triangle $M_1 M_2 M_3$ similar to a given triangle $B_1 B_2 B_3$ with the given side-ver…
Consider the matrix of size $24 \times 25$ with entries $0$ and $1$, where $1$ indicates that a student solved a problem.
Consider the total number of $n$-digit numbers, which is $9 \cdot 10^{n-1}$.
Let the arithmetic progression be
For part (a), the six points are the intersection points of four lines in general position.
We begin by examining the first sum for small values of $n$.
Consider first the smallest nontrivial case, a $2\times 2$ table with entries $a,b$ in the first row and $c,d$ in the second row.
Let
Consider a convex pentagon $ABCDE$ with vertices labeled consecutively.
Consider small analogues first.
Many search problems involve ranges rather than individual values.
Binary search is often associated with sorted data, but some of its most elegant applications work on arrays that are not sorted at all.
Binary search is a boundary-finding algorithm.
Lower bound finds the first position whose value is greater than or equal to a target.
A range query asks for information about a contiguous region of ordered data.
The examples in previous sections searched integer domains.
A binary search tree provides an elegant framework for maintaining ordered data.
Standard binary search assumes the entire array is sorted.
Most discussions of search algorithms focus on in-memory collections.
Segment trees are among the most versatile range-query data structures in algorithm design.
Many search problems ask for more than membership.
Arrays are excellent when data rarely changes.
Balanced trees provide logarithmic performance through carefully maintained structure.
Binary search does not fundamentally require sorted data.
Many range-query structures support updates.
Binary search trees work well in memory, where following a pointer from one node to another is relatively cheap.
The most useful form of binary search is not exact lookup.
AVL trees were the first self-balancing binary search trees.
Most balanced tree structures maintain balance through carefully designed invariants.
Most binary search examples begin with a sorted array.
Before studying specific balancing algorithms such as AVL trees and red-black trees, it is worth understanding the structure they are trying to preserve.
Tree rotations are the primitive operation behind many balanced binary search trees.
Parametric search is a technique for solving optimization problems by repeatedly answering decision questions.
Red-black trees are self-balancing binary search trees with a relatively loose balance condition.
A Fenwick tree, also called a binary indexed tree, is a compact data structure for prefix sums and point updates.
Design a crawler frontier that decides which URLs a web crawler should visit next.
Design an event scheduler that stores tasks, orders them by time, executes ready tasks, and handles updates such as cancellation or rescheduling.
Design a text diff tool that compares two versions of a document and reports what changed.
Design a spell checker that detects misspelled words and suggests likely corrections.
Design a cache that stores recently used values and evicts entries when capacity is full.
Design a search ranking pipeline that receives a user query, retrieves candidate documents, scores them, and returns a ranked result list.
Design a planner that receives a set of tasks and dependencies, then returns a valid execution order.
Design a small database index that supports fast lookup by key and efficient range scans.
Design an autocomplete engine that provides search suggestions while a user types.
Design a simulation that routes packets through a network of routers and links.
Design a static analyzer that scans source code and reports likely defects without running the program.
Design a small workflow for checking an algorithm's correctness argument against its implementation.
Design a system that consumes events continuously and computes live metrics such as counts, rates, unique users, moving averages, and top items.
Design a batch job that analyzes a large graph and computes useful metrics such as degree counts, connected components, PageRank-style importance scores, and community structure.
Design a recommendation system that suggests items to users based on past behavior.
Design a small constraint solver that assigns values to variables while satisfying a set of rules.
Design a service that answers shortest path queries over a graph.
You have learned dozens of algorithms and data structures.
Design a plagiarism detector that compares documents and reports suspicious similarity.
Design a geometry query engine that stores spatial objects and answers geometric questions efficiently.
Design a compression tool that reduces the size of textual data while preserving the original information.
Design a sorting tool that can sort data larger than available memory.
Design a system that receives a stream of log events and removes duplicates before storage or analysis.
Design a matchmaking system that pairs users, players, tasks, or entities according to compatibility rules.
Design a rate limiter that controls how often a client can perform an operation.
Hash tables are usually presented as deterministic data structures: compute a hash, reduce it to a table index, and store or retrieve the key.
Balanced search trees achieve logarithmic performance by carefully maintaining structural invariants.
Streaming algorithms process data one item at a time while using much less memory than the input size.
A Count-Min Sketch estimates item frequencies in a stream using fixed memory.
Randomized quicksort is one of the most successful applications of randomization in algorithm design.
Randomized algorithms differ from deterministic algorithms because their behavior depends on random choices made during execution.
Many optimization problems can be expressed as integer programs.
Randomized algorithms rarely stop at computing an expected value.
Primal-dual approximation algorithms use linear programming structure to design fast approximate solutions.
HyperLogLog estimates the number of distinct elements in a stream using a small, fixed amount of memory.
Las Vegas algorithms always return correct answers and use randomness to influence resource consumption.
A randomized algorithm can use randomness in several ways.
Randomized algorithms span a wide range of techniques.
A Bloom filter is one of the most widely deployed probabilistic data structures in modern computing.
Theoretical analysis explains why randomized algorithms work.
Shuffling converts an ordered collection into a uniformly random permutation.
Some optimization problems are easy to state and hard to solve exactly.