Formalism for complexity with precomputation?

32 Views Asked by At

I was wondering if there is a standard way/notation/nomenclature to define complexity with "precomputation". Basically, for every $n$, I have an input set $I_n$, and a function $f_n(x), x\in I_n$; I want to express the notion that, for every $n$, I can "pre-compute" for the entire dataset a datastructure $D_n$ at some cost $T_1(n)$, that will then allow me to "compute" $f_n(x)$ for any single $x\in I_n$ at some reduced cost $T_2(n)$.

In other words, I am willing to pay a potentially steep upfront cost (e.g. in terms of time) on the entire dataset, so that I can then answer queries about specific inputs cheaply. This is a well-known pattern in computer science (an elementary example: sort an array of $n$ elements in time $O(n\lg n)$, so that you can then find any given element in time $O(\lg n)$ - compare with finding any given element in the unsorted array in time $O(n)$).

Any pointers to standard notation/nomenclature for this type of "two-step" complexity?

1

There are 1 best solutions below

0
On

Most of the time, this two-step complexity is used in query problems. The first step is just a pre-computation. The second step is a "query problem". Instances of this problem can be seen in computational geometry a lot. For example, computations for creating a doubly connected link list to answer queries on a map. Or creating a Voronoi cell data structure to answer queries to find the nearest facility, and so on.