ArticleslgStudy

computer science

Range searching

Range searching is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Range searching rather than just read about it. In short: In computer science, the range searching problem consists of processing a set S of objects, in order to determine which objects from S intersect with a query object, called the range. For example, if S is a set of points corresponding to the coordinates of several cities, find the subset of cities within a given range of latitudes and longitudes.

Range searching — main illustration
Range searching — illustration

Key takeaways

  • Range searching belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Range searching to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Range searching from memory before moving on to harder problems.

Reference excerpt

In computer science, the range searching problem consists of processing a set S of objects, in order to determine which objects from S intersect with a query object, called the range. For example, if S is a set of points corresponding to the coordinates of several cities, find the subset of cities within a given range of latitudes and longitudes. The range searching problem and the data structures that solve it are a fundamental topic of computational geometry. Applications of the problem arise in areas such as geographical information systems (GIS), computer-aided design (CAD) and databases.

Variations There are several variations of the problem, and different data structures may be necessary for different variations. In order to obtain an efficient solution, several aspects of the problem need to be specified:

Object types: Algorithms depend on whether S consists of points, lines, line segments, boxes, polygons.... The simplest and most studied objects to search are points. Range types: The query ranges also need to be drawn from a predetermined set. Some well-studied sets of ranges, and the names of the respective problems are axis-aligned rectangles (orthogonal range searching), simplices, halfspaces, and spheres/circles. Query types: If the list of all objects that intersect the query range must be reported, the problem is called range reporting, and the query is called a reporting query. Sometimes, only the number of objects that intersect the range is required. In this case, the problem is called range counting, and the query is called a counting query. The emptiness query reports whether there is at least one object that intersects the range. In the semigroup version, a commutative semigroup (S,+) is specified, each point is assigned a weight from S, and it is required to report the semigroup sum of the weights of the points that intersect the range. Dynamic range searching vs. static range searching: In the static setting the set S is known in advance. In dynamic setting objects may be inserted or deleted between queries. Offline range searching: Both the set of objects and the whole set of queries are known in advance.

Data structures

Orthogonal range searching

In orthogonal range searching, the set S consists of n {\displaystyle n} points in d {\displaystyle d} dimensions, and the query consists of intervals in each of those dimensions. Thus, the query consists of a multi-dimensional axis-aligned rectangle. With an output size of k {\displaystyle k} , Jon Bentley used a k-d tree to achieve (in Big O notation) O ( n ) {\displaystyle O(n)} space and O ( n 1 − 1 d + k ) {\displaystyle O{\big (}n^{1-{\frac {1}{d}}}+k{\big )}} query time. Bentley also proposed using range trees, which improved query time to O ( log d ⁡ n + k ) {\displaystyle O(\log ^{d}n+k)} but increased space to O ( n log d − 1 ⁡ n ) {\displaystyle O(n\log ^{d-1}n)} . Dan Willard used downpointers, a special case of fractional cascading to reduce the query time further to O ( log d − 1 ⁡ n + k ) {\displaystyle O(\log ^{d-1}n+k)} . While the above results were achieved in the pointer machine model, further improvements have been made in the word RAM model of computation in low dimensions (2D, 3D, 4D). Bernard Chazelle used compress range trees to achieve O ( log ⁡ n ) {\displaystyle O(\log n)} query time and O ( n ) {\displaystyle O(n)} space for range counting. Joseph JaJa and others later improved this query time to O ( log ⁡ n log ⁡ log ⁡ n ) {\displaystyle O\left({\dfrac {\log n}{\log \log n}}\right)} for range counting, which matches a lower bound and is thus asymptotically optimal. As of 2015, the best results (in low dimensions (2D, 3D, 4D)) for range reporting found by Timothy M. Chan, Kasper Larsen, and Mihai Pătrașcu, also using compressed range trees in the word RAM model of computation, are one of the following:

O ( n ) {\displaystyle O(n)} space, O ( log ϵ ⁡ n + k log ϵ ⁡ n ) {\displaystyle O(\log ^{\epsilon }n+k\log ^{\epsilon }n)} query time

O ( n log ⁡ log ⁡ n ) {\displaystyle O(n\log \log n)} space, O ( log ⁡ log ⁡ n + k log ⁡ log ⁡ n ) {\displaystyle O(\log \log n+k\log \log n)} query time

… excerpt ends here. Continue reading the full article.

Illustrations

Range searching: Simplex range searching.
Simplex range searching.
Range searching: A 2D orthogonal range query. In this case, a range reporting query would return the two circled points, a range counting query would return 2, and an emptiness query would return false.
A 2D orthogonal range query. In this case, a range reporting query would return the two circled points, a range counting query would return 2, and an emptiness query would return false.

Worked examples

Example 1 — a first encounter with Range searching

Start with the simplest possible case. Write down what Range searching claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Range searching before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Range searching ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Range searching

In research
Range searching appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Range searching in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Range searching is common in secondary-school and first-year university syllabi. It links to neighbouring topics Database theory, Geometric data structures, so understanding it makes those chapters shorter.
In everyday life
Look for Range searching outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Range searching in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Range searching means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Range searching out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Range searching in simple terms?

In computer science, the range searching problem consists of processing a set S of objects, in order to determine which objects from S intersect with a query object, called the range. For example, if S is a set of points corresponding to the coordinates of several cities, find the subset of cities…

Why does Range searching matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Range searching?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Range searching.

Tags

  • Database theory
  • Geometric data structures

Keep exploring