|
ADS
Algorithms and Data Structures
|
Files | |
| BinarySearch.h | |
| The binary search of section 1.2 in a sorted vector \( A[ 0 .. n - 1 ] \): \( v \) is compared with the middle item \( A[ m ] \) of the part \( A[ i .. j ] \) still to examine, and the search goes on in \( A[ i .. m - 1 ] \) if \( v < A[ m ] \) and in \( A[ m + 1 .. j ] \) if \( v > A[ m ] \); the part halves at each call, so that at most \( \lfloor \log_2 n \rfloor + 1 \) calls are made, 2 comparisons each. | |
| CompressedPGMIndex.h | |
| The compressed PGM-index of Ferragina and Vinciguerra, beyond the book: the segments of the PGM-index [see PGMIndex.h] on a sorted array of arithmetic keys in a few tens of bits each instead of 28 bytes, with the same search at the last level (see The PGM-index compressed and dynamic). | |
| CountLess.h | |
| The count of the items of a short array smaller than a key, the search in a node of the B-trees in main memory [see BTreeMap.h and StaticSearch.h]: on a sorted array of \( N \) items it is the place of the key, found with no branch. | |
| DynamicPGMIndex.h | |
| The dynamic PGM-index of Ferragina and Vinciguerra, beyond the book: an ordered map from arithmetic keys to values, with insertions and removals, made of static PGM-indices [see PGMIndex.h] by the logarithmic method of Bentley and Saxe (see The PGM-index compressed and dynamic). | |
| InterpolationSearch.h | |
| The search by interpolation of section 12.1 in a sorted vector of numbers: in the part \( A[ i .. j ] \) the key \( v \) is looked for in the place. | |
| KnuthSearches.h | |
| Two searches of a sorted vector from Knuth, beyond the book [see BinarySearch.h for the binary search of section 1.2]: | |
| LocalOptima.h | |
| The local optima of a vector and of a binary tree, found without looking at all the items. | |
| Minimum.h | |
| The minimum of a vector \( A[ 0 .. n - 1 ] \) (section 1.2): min() keeps the minimum so far and compares it with each of the other items, \( n - 1 \) comparisons, which are needed, since each comparison can exclude at most one of the two items from being the minimum (section 2.6). | |
| MonotoneSearch.h | |
| The search of the first place where a monotone predicate becomes true, when no upper bound on that place is known: on the integers, on a sequence of unknown length, and on the integer square root. | |
| NthElement.h | |
| The engineered selection, beyond the book [see Selection.h for the selection of Hoare of section 17.1 and the median of the medians]: nthElement() puts in the place nth of the range \( [ \mathit{first} , \mathit{last} ) \) the item that would be there if the range were sorted, the items before it not larger and those after it not smaller, as std::nth_element, which it is meant to replace. | |
| PGMIndex.h | |
| The piecewise geometric model index of Ferragina and Vinciguerra, beyond the book: a learned index on a sorted array of arithmetic keys, which finds the place of the first item not smaller than a key [see StaticSearch.h for the static B+-tree] in a space that depends on the regularity of the keys rather than on their number. | |
| RangeMinimum.h | |
| The range minimum query, beyond the book: given an array \( A \) of \( n \) items of an ordered universe, the place of a minimum of \( A[ i .. j ] \) for any \( i \le j \), the leftmost one when the minimum repeats. | |
| Selection.h | |
| The selection of section 17.1: the item of rank \( k \), the \( k \)-th smallest, \( 1 \le k \le n \), the median for \( k = \lceil n / 2 \rceil \), without sorting. | |
| SortedSearches.h | |
| Searches in sorted vectors beyond the place of a given item [see BinarySearch.h]: the minimum of a rotated vector, the item closest to a value, two items with a given sum, and the item of a given rank in the union of two sorted vectors, whose middle ranks are the medians. | |
| StaticSearch.h | |
| The engineered searches of a sorted array that does not change, beyond the book [see BinarySearch.h for the binary search of section 1.2]: the place of the first item not smaller than a key, the lower bound, in the fewest misses of the cache and with no branch that the processor may mispredict. | |
| WordRangeMinimum.h | |
| The engineered range minimum query, beyond the book [see RangeMinimum.h for the sparse table and the solution of Bender and Farach-Colton]: the place of the leftmost minimum of \( A[ i .. j ] \), in \( O( 1 ) \) time with a few accesses to the memory and \( O( n ) \) words of space. | |