brain

tamnd's digital brain — notes, problems, research

41800 notes

Kvant Math Problem 245

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}$.

kvantmathematicsolympiad
Kvant Math Problem 244

The desired inequality can be rewritten as

kvantmathematicsolympiad
Kvant Math Problem 242

Denote the sides opposite $A_1,A_2,A_3$ by

kvantmathematicsolympiad
Kvant Math Problem 239

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|$.

kvantmathematicsolympiad
Kvant Math Problem 238

Let

kvantmathematicsolympiad
Kvant Math Problem 236

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$.

kvantmathematicsolympiad
Kvant Math Problem 235

Consider a lion moving along a polygonal path inside a circular arena of radius $R = 10$ meters.

kvantmathematicsolympiad
Kvant Math Problem 233

Consider a small case to understand the process.

kvantmathematicsolympiad
Kvant Math Problem 231

Consider the equation $n^x + n^y = n^z$ in natural numbers.

kvantmathematicsolympiad
Kvant Math Problem 230

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$.

kvantmathematicsolympiad
Kvant Math Problem 228

Consider small values of $n$ first.

kvantmathematicsolympiad
Kvant Math Problem 226

Place the square in the coordinate plane with vertices

kvantmathematicsolympiad
Kvant Math Problem 225

Consider a die with faces numbered so that opposite faces sum to $7$.

kvantmathematicsolympiad
Kvant Math Problem 223

Perfect numbers are rare and highly structured.

kvantmathematicsolympiad
Kvant Math Problem 221

Consider an arbitrary compact planar blot.

kvantmathematicsolympiad
Kvant Math Problem 220

The problem concerns a king moving on an $8\times 8$ chessboard, visiting every square exactly once, and returning to the starting square.

kvantmathematicsolympiad
Kvant Math Problem 218

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.

kvantmathematicsolympiad
Kvant Math Problem 217

Consider first a triangle, the simplest convex polygon.

kvantmathematicsolympiad
Kvant Math Problem 215

Consider a small patch of the grid with just one black cell at $(0,0)$.

kvantmathematicsolympiad
Kvant Math Problem 213

Let the circle have center $I$.

kvantmathematicsolympiad
Kvant Math Problem 212

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.

kvantmathematicsolympiad
Kvant Math Problem 210

The operation does not act on individual digits.

kvantmathematicsolympiad
Kvant Math Problem 208

Let

kvantmathematicsolympiad
Kvant Math Problem 207

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…

kvantmathematicsolympiad
Kvant Math Problem 205

Consider the matrix of size $24 \times 25$ with entries $0$ and $1$, where $1$ indicates that a student solved a problem.

kvantmathematicsolympiad
Kvant Math Problem 204

Consider the total number of $n$-digit numbers, which is $9 \cdot 10^{n-1}$.

kvantmathematicsolympiad
Kvant Math Problem 202

Let the arithmetic progression be

kvantmathematicsolympiad
Kvant Math Problem 200

For part (a), the six points are the intersection points of four lines in general position.

kvantmathematicsolympiad
Kvant Math Problem 199

We begin by examining the first sum for small values of $n$.

kvantmathematicsolympiad
Kvant Math Problem 197

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.

kvantmathematicsolympiad
Kvant Math Problem 195

Let

kvantmathematicsolympiad
Kvant Math Problem 193

Consider a convex pentagon $ABCDE$ with vertices labeled consecutively.

kvantmathematicsolympiad
Kvant Math Problem 192

Consider small analogues first.

kvantmathematicsolympiad
7.9 Interval Search

Many search problems involve ranges rather than individual values.

algorithmsbinary-searchordered-data
7.8 Peak Finding

Binary search is often associated with sorted data, but some of its most elegant applications work on arrays that are not sorted at all.

algorithmsbinary-searchordered-data
7.1 Binary Search Template

Binary search is a boundary-finding algorithm.

algorithmsbinary-searchordered-data
7.3 Upper Bound Searches

Lower bound finds the first position whose value is greater than or equal to a target.

algorithmsbinary-searchordered-data
7.19 Range Queries

A range query asks for information about a contiguous region of ordered data.

algorithmsbinary-searchordered-data
7.6 Floating-Point Binary Search

The examples in previous sections searched integer domains.

algorithmsbinary-searchordered-data
7.11 Balanced Trees

A binary search tree provides an elegant framework for maintaining ordered data.

algorithmsbinary-searchordered-data
7.7 Rotated Arrays

Standard binary search assumes the entire array is sorted.

algorithmsbinary-searchordered-data
7.24 Search Structures in Databases

Most discussions of search algorithms focus on in-memory collections.

algorithmsbinary-searchordered-data
7.20 Segment Trees

Segment trees are among the most versatile range-query data structures in algorithm design.

algorithmsbinary-searchordered-data
7.23 Order Statistics Trees

Many search problems ask for more than membership.

algorithmsbinary-searchordered-data
7.10 Ordered Maps

Arrays are excellent when data rarely changes.

algorithmsbinary-searchordered-data
7.18 Skip Lists

Balanced trees provide logarithmic performance through carefully maintained structure.

algorithmsbinary-searchordered-data
7.5 Monotone Predicates

Binary search does not fundamentally require sorted data.

algorithmsbinary-searchordered-data
7.22 Sparse Tables

Many range-query structures support updates.

algorithmsbinary-searchordered-data
7.17 B-Trees

Binary search trees work well in memory, where following a pointer from one node to another is relatively cheap.

algorithmsbinary-searchordered-data
7.2 Lower Bound Searches

The most useful form of binary search is not exact lookup.

algorithmsbinary-searchordered-data
7.16 AVL Trees

AVL trees were the first self-balancing binary search trees.

algorithmsbinary-searchordered-data
7.14 Treaps

Most balanced tree structures maintain balance through carefully designed invariants.

algorithmsbinary-searchordered-data
7.4 Search on Answer

Most binary search examples begin with a sorted array.

algorithmsbinary-searchordered-data
7.12 Binary Search Trees

Before studying specific balancing algorithms such as AVL trees and red-black trees, it is worth understanding the structure they are trying to preserve.

algorithmsbinary-searchordered-data
7.13 Tree Rotations

Tree rotations are the primitive operation behind many balanced binary search trees.

algorithmsbinary-searchordered-data
7.25 Parametric Search

Parametric search is a technique for solving optimization problems by repeatedly answering decision questions.

algorithmsbinary-searchordered-data
7.15 Red-Black Trees

Red-black trees are self-balancing binary search trees with a relatively loose balance condition.

algorithmsbinary-searchordered-data
7.21 Fenwick Trees

A Fenwick tree, also called a binary indexed tree, is a compact data structure for prefix sums and point updates.

algorithmsbinary-searchordered-data
20.13 Building a Web Crawler Frontier

Design a crawler frontier that decides which URLs a web crawler should visit next.

algorithmscase-studiessystems
20.4 Building an Event Scheduler

Design an event scheduler that stores tasks, orders them by time, executes ready tasks, and handles updates such as cancellation or rescheduling.

algorithmscase-studiessystems
20.5 Building a Text Diff Tool

Design a text diff tool that compares two versions of a document and reports what changed.

algorithmscase-studiessystems
20.10 Building a Spell Checker

Design a spell checker that detects misspelled words and suggests likely corrections.

algorithmscase-studiessystems
20.12 Building a Cache Eviction Policy

Design a cache that stores recently used values and evicts entries when capacity is full.

algorithmscase-studiessystems
20.2 Building a Search Ranking Pipeline

Design a search ranking pipeline that receives a user query, retrieves candidate documents, scores them, and returns a ranked result list.

algorithmscase-studiessystems
20.17 Building a Task Dependency Planner

Design a planner that receives a set of tasks and dependencies, then returns a valid execution order.

algorithmscase-studiessystems
20.15 Building a Mini Database Index

Design a small database index that supports fast lookup by key and efficient range scans.

algorithmscase-studiessystems
20.1 Building an Autocomplete Engine

Design an autocomplete engine that provides search suggestions while a user types.

algorithmscase-studiessystems
20.16 Building a Packet Routing Simulation

Design a simulation that routes packets through a network of routers and links.

algorithmscase-studiessystems
20.14 Building a Static Analyzer

Design a static analyzer that scans source code and reports likely defects without running the program.

algorithmscase-studiessystems
20.24 Building a Verified Algorithm Sketch

Design a small workflow for checking an algorithm's correctness argument against its implementation.

algorithmscase-studiessystems
20.21 Building a Streaming Analytics System

Design a system that consumes events continuously and computes live metrics such as counts, rates, unique users, moving averages, and top items.

algorithmscase-studiessystems
20.8 Building a Graph Analytics Job

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.

algorithmscase-studiessystems
20.9 Building a Recommendation Prototype

Design a recommendation system that suggests items to users based on past behavior.

algorithmscase-studiessystems
20.20 Building a Constraint Solver

Design a small constraint solver that assigns values to variables while satisfying a set of rules.

algorithmscase-studiessystems
20.3 Building a Shortest Path Service

Design a service that answers shortest path queries over a graph.

algorithmscase-studiessystems
20.25 Building an Algorithm Engineering Playbook

You have learned dozens of algorithms and data structures.

algorithmscase-studiessystems
20.18 Building a Plagiarism Detector

Design a plagiarism detector that compares documents and reports suspicious similarity.

algorithmscase-studiessystems
20.19 Building a Geometry Query Engine

Design a geometry query engine that stores spatial objects and answers geometric questions efficiently.

algorithmscase-studiessystems
20.6 Building a Compression Tool

Design a compression tool that reduces the size of textual data while preserving the original information.

algorithmscase-studiessystems
20.22 Building an External Merge Sort

Design a sorting tool that can sort data larger than available memory.

algorithmscase-studiessystems
20.7 Building a Log Deduplication System

Design a system that receives a stream of log events and removes duplicates before storage or analysis.

algorithmscase-studiessystems
20.23 Building a Matchmaking System

Design a matchmaking system that pairs users, players, tasks, or entities according to compatibility rules.

algorithmscase-studiessystems
20.11 Building a Rate Limiter

Design a rate limiter that controls how often a client can perform an operation.

algorithmscase-studiessystems
19.8 Hashing with Randomness

Hash tables are usually presented as deterministic data structures: compute a hash, reduce it to a table index, and store or retrieve the key.

algorithmsrandomizedapproximation
19.7 Skip Lists Revisited

Balanced search trees achieve logarithmic performance by carefully maintaining structural invariants.

algorithmsrandomizedapproximation
19.20 Streaming Algorithms

Streaming algorithms process data one item at a time while using much less memory than the input size.

algorithmsrandomizedapproximation
19.12 Count-Min Sketch Revisited

A Count-Min Sketch estimates item frequencies in a stream using fixed memory.

algorithmsrandomizedapproximation
19.4 Randomized Quicksort

Randomized quicksort is one of the most successful applications of randomization in algorithm design.

algorithmsrandomizedapproximation
19.1 Random Variables in Algorithms

Randomized algorithms differ from deterministic algorithms because their behavior depends on random choices made during execution.

algorithmsrandomizedapproximation
19.17 Randomized Rounding

Many optimization problems can be expressed as integer programs.

algorithmsrandomizedapproximation
19.22 Probability Bounds

Randomized algorithms rarely stop at computing an expected value.

algorithmsrandomizedapproximation
19.18 Primal-Dual Approximation

Primal-dual approximation algorithms use linear programming structure to design fast approximate solutions.

algorithmsrandomizedapproximation
19.10 HyperLogLog

HyperLogLog estimates the number of distinct elements in a stream using a small, fixed amount of memory.

algorithmsrandomizedapproximation
19.3 Monte Carlo Algorithms

Las Vegas algorithms always return correct answers and use randomness to influence resource consumption.

algorithmsrandomizedapproximation
19.2 Las Vegas Algorithms

A randomized algorithm can use randomness in several ways.

algorithmsrandomizedapproximation
19.25 Choosing the Right Randomized Technique

Randomized algorithms span a wide range of techniques.

algorithmsrandomizedapproximation
19.11 Bloom Filters Revisited

A Bloom filter is one of the most widely deployed probabilistic data structures in modern computing.

algorithmsrandomizedapproximation
19.24 Randomized Algorithms in Practice

Theoretical analysis explains why randomized algorithms work.

algorithmsrandomizedapproximation
19.6 Shuffling

Shuffling converts an ordered collection into a uniformly random permutation.

algorithmsrandomizedapproximation
19.14 Approximation Ratios

Some optimization problems are easy to state and hard to solve exactly.

algorithmsrandomizedapproximation