Skip to content
LUDA · 學思辨行

LUDA · 學思辨行

Learn extensively, Understand deeply, Discern clearly, and Act resolutely.

  • About
  • Learning Path

Category: Searching

Hash table — look up a key in the slot its hash names

November 21, 2026By HoHo Zhao

A hash table finds a key by turning it into a slot number and reading that slot. It fits a collection that will be asked many times, when the only question is whether the key is present. It does not fit a single query, a request for the next…

Algorithms, SearchingLeave a comment

How ternary search narrows a unimodal function

November 13, 2026By HoHo Zhao

Short answer: Ternary search finds the minimum of a unimodal function by comparing the function at the one-third and two-third points and discarding the third that cannot hold the minimum. Each step keeps 2/3 of the interval, so the number of evaluations is Θ(log n), with two evaluations per…

Algorithms, SearchingLeave a comment

How quickselect finds one order statistic

November 13, 2026By HoHo Zhao

Short answer: Quickselect partitions around a pivot and recurses into the only side that still contains rank k. A partition that places the pivot at its final index answers immediately when that index equals k. The expected cost with a random pivot is Θ(n). A pivot that always leaves…

Algorithms, SearchingLeave a comment

How median of medians selects in linear time

November 13, 2026By HoHo Zhao

Short answer: Median of medians chooses a quickselect pivot by splitting the array into groups of five, taking each group’s median, and recursively selecting the median of those medians. That pivot is guaranteed to drop a constant fraction of the array. The recurrence T(n) ≤ T(n/5) + T(7n/10) +…

Algorithms, SearchingLeave a comment

Linear search — find a key by scanning each item once

November 13, 2026By HoHo Zhao

Linear search finds a key by reading items in order until one matches or the sequence ends. It fits an unordered sequence, a linked list, a short array, and a single query. It does not fit a long sorted array, or a collection that will be queried many times.…

Algorithms, Searching1 Comment

How jump search blocks a sorted array

November 13, 2026By HoHo Zhao

Short answer: Jump search walks a sorted array in strides of length m and, once a stride overshoots the target, scans the previous block linearly. The cost is about n/m + m comparisons. That sum is minimized at m = √n, which makes the search Θ(√n). On random-access memory,…

Algorithms, SearchingLeave a comment

How interpolation search places the next probe

November 13, 2026By HoHo Zhao

Short answer: Interpolation search probes a sorted numeric array at the index the target would occupy if the keys between the ends were evenly spaced. Under independent uniform keys the expected number of probes is O(log log n). On a skewed distribution the same formula walks the array almost…

Algorithms, SearchingLeave a comment

How Fibonacci search splits on Fibonacci sizes

November 13, 2026By HoHo Zhao

Short answer: Fibonacci search probes a sorted array on boundaries taken from the Fibonacci sequence, so each remaining window has a Fibonacci length and the next window is the previous Fibonacci number. The comparison count is O(log n), the same order as binary search. Index arithmetic uses addition and…

Algorithms, SearchingLeave a comment

How exponential search brackets a nearby key

November 13, 2026By HoHo Zhao

Short answer: Exponential search probes a sorted array at indices 1, 2, 4, 8, and so on, until the key at the probe is at least the target or the array ends. It then binary-searches the bracket that contains the answer. If the target sits at position p, the…

Algorithms, SearchingLeave a comment

How binary search maintains a half-open range

November 13, 2026By HoHo Zhao

Short answer: Binary search keeps the invariant that a missing or matching key, if it is present, lies in a half-open index range [lo, hi). The midpoint is lo + (hi−lo)//2, which does not overflow when lo and hi are large. The loop that sets hi = mid when…

Algorithms, SearchingLeave a comment
  • Algorithms
  • Arithmetic
  • Authelia
  • Clustering
  • Coding
  • Compression
  • Cryptography
  • CSS
  • Distributed Systems
  • Docker
  • Dynamic Programming
  • Exact Algorithms
  • Games
  • Geometry
  • Grafana
  • Graphs
  • Greedy
  • Heaps
  • Homelab
  • IPsec
  • LDAP
  • Linear Algebra
  • Logging
  • Loki
  • nginx
  • Number Theory
  • Numerical
  • Optimization
  • Parsing
  • Prometheus
  • Randomization
  • Range Queries
  • Sampling
  • Scheduling
  • Search
  • Searching
  • Sequences
  • Sketches
  • Sorting
  • Streams
  • Strings
  • SVG
  • Synchronization
  • Systems
  • Transforms
  • Trees

Docker EAP-MSCHAPv2 FreeRADIUS Grafana gzip IKEv2 IPsec LogQL Loki OpenLDAP Promtail StrongSwan

© 2026 LUDA · 學思辨行. Powered by WordPress.