Algorithmresearch
Demaine-Lopez-Ortiz-Munro adaptive intersection
Also called adaptive set intersection.
Intersects k sorted sets by cycling through them with galloping search, in time bounded by the size of a proof of the result.
- Time
- Ω(m log(n/m + 1)) lowerO(m log(n/m + 1)) two_lists
- Space
- O(k) extra
- Where
- k = the number of lists; m = the length of the shorter of two lists; n = the length of the longer of two lists
- Model
- Comparison model
- Properties
- comparison baseddeterministiciterative
- Evidence
- Proof sketchCode in 1 languages
The adaptive intersection of Erik Demaine, Alejandro López-Ortiz and Ian Munro intersects sorted lists by keeping one candidate id, the eliminator, and searching for it in the lists in turn with galloping steps. A list that holds an id greater than the eliminator gives a new eliminator; when all lists hold it, it goes to the output. The cost depends on how the lists interleave, not only on their lengths: an input whose result has a short proof is fast. The paper of 2000 gallops in each set from both ends and proves at most comparisons, where is the gap cost of the shortest proof of the result. This page gives the simpler form that gallops forward only. For two lists of lengths , it makes at most tests, which is at most 8 times the lower bound of every algorithm in the comparison model. The proof of that lower bound is on this page, and the merge, small-versus-small and Baeza-Yates pages use it.
In plain words
Pick the first number of the shortest list as the candidate. Go to the next list and jump forward in it, by steps that double, until you pass the candidate. Then search back in the last jump to find the first number that is not smaller than the candidate.
If that number is the candidate, this list agrees, and you go on to the next list. If it is larger, it is the new candidate, and the other lists must check it again. When every list agrees, the candidate is in the answer, and the next number of the last list becomes the new candidate.
Each list keeps its own place and never moves back. When the lists have long runs with no common numbers, the doubling jumps cross a run at a cost that grows only with the number of digits of its length.
The problem
The input is lists of document ids, each strictly increasing. The output is the list of ids that are in all of them, in increasing order. It is the AND query of posting list intersection.
The algorithm
is the set of lists that are known to hold the eliminator , and is the list of the last search. Each list has an index , below which all of its ids are already dealt with, and a step .
ADAPTIVE(L_0, ..., L_{k-1}) ▷ each list strictly increasing- 1
sort the lists by length, shortest first; if a list is empty then return () - 2
e ← L_0[0], pos(0) ← 1, H ← {0}, ℓ ← 0; pos(s) ← 0, jump(s) ← 1 for each other s - 3
loop - 4
if |H| = k then ▷ all lists hold e - 5
append e to R - 6
if pos(ℓ) = |L_ℓ| then return R - 7
e ← L_ℓ[pos(ℓ)], pos(ℓ) ← pos(ℓ) + 1, H ← {ℓ}, and go to L4 - 8
s ← the next list after s, in round robin, that is not in H - 9
if pos(s) = |L_s| then return R - 10
p ← min(pos(s) + jump(s) - 1, |L_s| - 1) - 11
if L_s[p] < e then ▷ one doubling step - 12
if p = |L_s| - 1 then return R - 13
pos(s) ← p + 1, jump(s) ← 2 jump(s) else ▷ e lies in L_s[pos(s)..p]- 14
a ← pos(s), c ← p - 15
while a < c: q ← ⌊(a + c)/2⌋; if L_s[q] < e then a ← q + 1 else c ← q - 16
pos(s) ← a + 1, jump(s) ← 1, ℓ ← s - 17
if L_s[a] = e then H ← H ∪ {s} - 18
else e ← L_s[a], H ← {s}
Each pass of lines L8 to L18 makes one doubling step in one list, so with the lists that are not in take turns, one step each. A run of a list is its sequence of steps from to the next search. The stops at lines L9 and L12 mean that one list has no id at least , so no more ids can be common.
Example
Intersect with , the 20 even numbers from 2 to 40, with . is shorter, so it is , and the first eliminator is 7.
| run | eliminator | probes of line L11 | search of line L15 | line L17 | tests | result |
|---|---|---|---|---|---|---|
| , 1 | 7 | , , | , | 6 | ||
| , 1 | 8 | none | 2 | |||
| , 2 | 20 | , , | , | 6 | output 20, | |
| , 2 | 22 | none | 2 | |||
| , 3 | 40 | , , , | 6 | output 40, then stop at line L6 |
The result is after 22 tests. The bound of Theorem 2 below is . On this input, Baeza-Yates makes 13 tests and small-versus-small makes 19, because each new eliminator from starts a new run in with a step of 1.
On the toy collection, sorted AND array AND search sorts the lists to search , array and sorted , and returns document 1 after 12 tests. Posting AND list returns after 4 tests. For 10 random ids and 10000 random ids below , it made 211 tests, against the bound of about 259.3 and the lower bound of about 111.1.
Correctness
The proof keeps four facts before each check of line L4. The output is strictly increasing and holds only common ids, all less than . Every common id not yet in the output is at least . In a list not in , every id below is less than . In a list in , the id just below is , and the ones before it are less. A doubling step keeps these facts because the list is sorted. A search finds the first id at least , so either the list joins or its id becomes a larger eliminator, and no common id lies between the old and the new eliminator. The sum of the indices grows at each pass, so the loop stops, and each stop happens only when no common id at least is left. The full proof is in the proof file below.
Proof: The adaptive intersection is correct and within a constant factor of the log2 C(m+n, m) lower boundfull
The input is lists , each strictly increasing, sorted so that , where . A test is one two-way comparison of ids, or . The line numbers are those of the main block of the page. If a list is empty, the algorithm returns the empty list with no test, which is correct, so from here each . The state is the eliminator , the set of lists that are known to hold (the set held), and for each list the index and the step .
Invariant. Before each check of line L4:
- (I1) the output is strictly increasing, each output id is common to all lists, and each output id is less than ;
- (I2) each common id that is not in the output is at least ;
- (I3) for each list , every id of at an index below is less than ;
- (I4) for each list , , and every id of at a lower index is less than .
Lemma 1. The invariant holds at the start and after each pass of the loop.
Proof. At the start, , , and for . (I1) holds with an empty output, (I3) holds with no ids below index 0, and (I4) holds for list 0. A common id is in , so it is at least , which is (I2).
Lines L5 to L7. When holds all lists, (I4) says that is in each list, so is common. By (I1) it is greater than the ids already in the output, so the output stays strictly increasing after line L5. Let be the list of the last search. If , line L7 sets , the next id of after , so . (I1) holds because the new output id is less than . A common id that is not in the output is at least by (I2), is not , and is in , so it is at least , which is (I2). (I4) holds for after grows by one. For each other list, the ids below are at most , which is (I3), because is now .
Lines L10 to L13. A step on a list probes . If , every id of up to index is less than , so (I3) holds after . Nothing else changes.
Lines L14 to L18. If , the binary search on uses and (I3), so it returns the least index with (Lemma 2 of the proof file of the posting list page). Then . If , list joins and (I4) holds for it. Else and . (I4) holds for . For each other list, the ids below its index are at most by (I3) and (I4), so (I3) holds for it. A common id not in the output is at least by (I2), and it is in , so it is at least , which is (I2). (I1) holds because .
Theorem 1 (correctness). The algorithm stops, and it returns the ids common to all lists, in increasing order.
Proof. Each pass either stops or increases : line L7 adds one to , line L13 sets with , and line L16 sets with . This sum is at most , so the loop stops. It stops at one of three lines.
- Line L6: the common id was output, and the list has no id after , so no common id is greater than .
- Line L9: for a list , so by (I3) every id of is less than .
- Line L12: , so every id of is less than .
In the last two cases, no common id is at least . In all three cases, (I2) says that each common id is in the output, and (I1) says that the output holds only common ids, in increasing order.
The count of tests
A run of list is a maximal sequence of steps of lines L10 and L11 on that starts with . A run ends with a binary search (lines L14 to L18), with the stop of line L12, or when the algorithm stops at another line. Let be the number of runs of list ; the code counts it. Let be the value of at the start of a run, and let its span be if the run ends at line L12, and the value of at its end minus in the other cases.
Lemma 2 (one run). A run with span has and makes at most tests.
Proof. Step of the run, for , starts with and , and probes . Let the run make steps with the result "less than", then one more step.
- If the last step has the result "not less", the binary search runs on , a range of at most indices whose last index is known to hold an id at least . It makes at most tests, because each test halves this range. Line L17 makes one more test. The total is at most . The new index is , so and .
- If the last step stops at line L12, the run made tests, and , so , and .
- If the algorithm stops on another list after steps of this run, the run made tests and , so .
In each case .
Lemma 3 (one list). List makes at most tests, or none if .
Proof. Each test is made in a run of the list that makes it. The index never goes down and a run starts at the current index, so the spans of the runs of cover disjoint ranges of indices, and their sum is at most . By Lemma 2 and Jensen's inequality for the concave function , the runs make at most tests, which is at most the bound.
Lemma 4. Let be the number of values that takes. Then for each list .
Proof. A run of starts only when . A run that does not end the algorithm ends at line L17 or L18 with , and leaves only when changes, at line L7 or line L18. So two runs of start under two different values of .
With Lemma 4 and the fact that is nondecreasing in for each , the total number of tests is at most . Each value of is an id of the input, and the values increase, so is at most the number of distinct ids. On inputs with a short proof of the result, is small.
Theorem 2 (two lists). For with , the algorithm makes at most
tests.
Proof. When and is not full, holds one list and each step is on the other one. A run of list ends with , and if line L7 follows, becomes again. So the runs of the two lists alternate, and the first run is a run of list 1. This gives . Each run of list 0 has span at least 1 by Lemma 2, the spans are disjoint, and none of them holds index 0, which line L2 takes with no test. So and . By Lemma 3 and the monotone function , list 0 makes at most tests and list 1 makes at most tests. For the second form, , so , because .
The lower bound
The comparison model: an algorithm sees the ids only through comparisons of two input ids, with the outcomes , and (a two-way test gives less information). For fixed lengths, the algorithm is a decision tree, and each leaf fixes the output as a set of positions of .
Lemma 5 (adjacent pairs). Let the input be two lists and with all ids distinct, so that is empty. In the merged order of all ids, let and be adjacent and in different lists. Then every correct algorithm compares with on this input.
Proof. Say is in , is in and ; the other cases are the same. Suppose the algorithm does not compare with . Change the input by giving the value of . The list stays strictly increasing: the id of before is less than , is not , and no id lies between and , so it is less than . Each comparison of with an id has the same outcome as before, because no id lies strictly between and , and . Comparisons that do not involve do not change. So the new input follows the same path to the same leaf, and the algorithm gives the same output, the empty set. But on the new input, is common to both lists. This is a contradiction.
Theorem 3 (lower bound). Every algorithm in the comparison model that intersects two sorted lists of lengths and makes at least comparisons on some input.
Proof. Take the inputs made from the ids , one for each choice of the ids that go to ; gets the rest. Let such an input reach the leaf . By Lemma 5, the path to holds the outcome of each comparison of two adjacent ids from different lists, and the order of two adjacent ids from the same list is known in advance. So the outcomes on the path, with the order inside each list, fix the whole merged order, and with it the choice of the ids of . So the inputs reach different leaves. On these inputs no comparison has the outcome , so each node on their paths has at most two children that they use. A binary tree with at least leaves has depth at least , and depth is an integer.
Corollary 4 (equal lengths). For , every correct algorithm makes at least comparisons on the input , because all adjacent pairs of the merged order are in different lists (Lemma 5). The merge makes at most three-way steps, so it is exactly optimal in this count.
Remark. Lemma 5 is the reason that the cost of an adaptive algorithm can depend on the input and not only on the lengths. On a given input, the comparisons that a correct algorithm must make form a certificate of the result. When the two lists interleave in few blocks, this certificate is short, and the galloping steps of the algorithm find each block boundary at a cost that is logarithmic in the block length. Theorem 3 bounds the worst case over all inputs of the given lengths, and Theorem 2 shows that the algorithm meets it up to a factor of 8.
Complexity
- One run. A run that moves the index of its list by makes at most tests: doubling probes, at most tests of the binary search, and one equality test, with .
- One list. The runs of a list cover disjoint parts of it, so by Jensen's inequality a list of length with runs makes at most tests. Two runs of a list start under two different eliminators, so , the number of values of .
- Two lists. For the runs alternate between the lists, so the longer list has at most runs and the shorter one at most . This gives at most tests.
- Lower bound. Every comparison algorithm needs comparisons in the worst case, and when . The proof: on an input with no common id, an algorithm must compare each two ids that are next to each other in the merged order and come from different lists; if it skips one pair, making the two ids equal does not change any outcome, but it changes the answer. So the outcomes at a leaf of the decision tree fix the interleaving of the two lists, and the interleavings need that many leaves.
- The paper. With galloping from both ends, Demaine, López-Ortiz and Munro prove time and at most comparisons (Theorem 5.1 and Corollary 5.2), where is the gap cost of the shortest proof of the result. This page does not prove that bound for the one-sided form.
- Time and space. The code finds the next list not in by a scan, which costs per step; a circular list of the lists not in makes it . The extra space is for the indices and steps.
Properties
- Adaptive. The cost follows the structure of the input. Two lists that interleave in a few long blocks cost a few galloping runs, whatever their lengths.
- Forward only. Each index only grows, so the galloping step can be replaced by any forward seek to the first id at least , such as one on a posting list with skip pointers or a block index. The bounds of this page are for galloping on arrays.
- No list is special. After the first eliminator, the order of the lists does not matter for correctness. The sort by length only gives the first eliminator from the shortest list.
- Output in order. The ids come out in increasing order, so the result can be piped into the next query step.
Variants and improvements
- Galloping from both ends. The algorithm of the paper also searches each set from its far end, so that the cost of the largest gap in a set is not paid in full. This is the form that the bound is for.
- Sequential. Barbay and Kenyon search the eliminator in one list until it is found or passed, then go to the next list in a cycle, in place of one doubling step per list. For two lists, the form of this page also searches one list at a time.
- Small Adaptive. Barbay, López-Ortiz, Lu and Salinger study this variant next to small-versus-small and the adaptive methods in their experiments on web queries.
- Joins. The leapfrog join in leapfrog triejoin uses the same pattern for sorted iterators with a seek: the largest current key is the target, and the other iterators seek to it in turn.
When to use it
Use it for AND queries of three or more terms, or when the lists may interleave in long blocks, for example when the documents of one topic have nearby ids. For two lists that differ a lot in length, small-versus-small or Baeza-Yates have the same bound with less bookkeeping. For two lists of about the same length that interleave finely, the merge makes fewer tests.
Pitfalls
- Galloping from the start of the list. Each run must start at , not at index 0. A restart costs about per search and loses the adaptive bound.
- Not resetting the step. Line L16 must set . If the step keeps its large value, the next run starts with a long jump and a long binary search, even when the next id is close.
- Output too early. An id is common only when all lists hold it. Output at line L5 only when has all lists, and remove the other lists from at each new eliminator, at line L7 and line L18.
- Repeated ids. The proof needs each list to be strictly increasing. A list with a repeated id can make the equality test of line L17 see the same id twice.
- One list. With , is full at the start. Line L7 must go back to line L4, else the round robin of line L8 finds no list to step on.
Implementations
Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/adaptive-set-intersection/. The authors are listed in prov/340HGS.jsonl.
from typing import Any, Sequence
def adaptive_intersect(lists: Sequence[Sequence[Any]], stats: dict[str, Any] | None = None) -> list[Any]:
"""Return the ids that are in each list, in increasing order.
The one-sided form of the adaptive algorithm of Demaine, Lopez-Ortiz and Munro:
one eliminator e, and one doubling step at a time in each list that is not yet
known to hold e, in round robin. Precondition: at least one list, each strictly
increasing. Only the tests < and == are used. A list s with r_s galloping runs
makes at most 2 r_s log2(1 + n_s / r_s) + 2 r_s tests.
If stats is a dict, it receives "runs" (the number of runs in each list, in the
sorted order), "lengths" (the sorted lengths) and "eliminators" (how many times e
was set).
"""
order = sorted(lists, key=len) # @line L1
k = len(order)
runs = [0] * k
elims = 0
out: list[Any] = []
if all(len(lst) > 0 for lst in order):
pos = [0] * k
jump = [1] * k
e = order[0][0] # @line L2
elims = 1
pos[0] = 1
held = {0}
last = 0
s = 0
while True: # @line L3
if len(held) == k: # @line L4
out.append(e) # @line L5
if pos[last] == len(order[last]): # @line L6
break
e = order[last][pos[last]] # @line L7
elims += 1
pos[last] += 1
held = {last}
continue
s = (s + 1) % k # @line L8
while s in held:
s = (s + 1) % k
lst = order[s]
n = len(lst)
if pos[s] == n: # @line L9
break
if jump[s] == 1:
runs[s] += 1
p = min(pos[s] + jump[s] - 1, n - 1) # @line L10
if lst[p] < e: # @line L11
if p == n - 1: # @line L12
break
pos[s] = p + 1 # @line L13
jump[s] *= 2
else:
a, c = pos[s], p # @line L14
while a < c: # @line L15
q = (a + c) // 2
if lst[q] < e:
a = q + 1
else:
c = q
pos[s] = a + 1 # @line L16
jump[s] = 1
last = s
if lst[a] == e: # @line L17
held.add(s)
else:
e = lst[a] # @line L18
elims += 1
held = {s}
if stats is not None:
stats["runs"] = runs
stats["lengths"] = [len(lst) for lst in order]
stats["eliminators"] = elims
return out
irtoy.py 76 lines
# SPDX-License-Identifier: MIT
# Shared helper of the information retrieval pages of https://algorithm.tamnd.com/. The authors are listed in prov/.
"""The toy collection of the information retrieval pages.
Eight short documents, four queries with graded judgments and one fixed
run. Tokens are the lower-case words split on spaces, with no stemming
and no stop words. The helper holds only the data and the statistics
tokenize, tf, df, cf, doc_len and avgdl. Scoring and metrics live on the
pages that define them.
"""
DOCS = {
1: "binary search finds a key in a sorted array",
2: "merge sort merges two sorted runs into one sorted array",
3: "an inverted index maps each term to a posting list",
4: "a posting list is a sorted list of document ids",
5: "skip pointers speed up the merge of two posting lists",
6: "a hash table finds a key in constant expected time",
7: "search engines rank documents by a score for the query",
8: "the sorted array of ids is compressed with gap encoding",
}
N = len(DOCS)
QUERIES = {
"q1": "sorted array search",
"q2": "posting list merge",
"q3": "rank documents",
"q4": "quantum circuit",
}
# Graded judgments: 2 is highly relevant, 1 is relevant, absent is 0.
QRELS = {
"q1": {1: 2, 2: 1, 8: 1},
"q2": {5: 2, 4: 1, 3: 1},
"q3": {7: 2},
"q4": {},
}
# A fixed run for the metric pages, as scores per query.
RUN = {
"q1": {1: 2.0, 6: 2.0, 8: 1.5, 2: 1.0, 4: 1.0},
}
def tokenize(text):
"""Lower-case words split on spaces."""
return text.lower().split()
_TOKENS = {d: tokenize(t) for d, t in DOCS.items()}
def tf(term, doc_id):
"""Number of times term occurs in document doc_id."""
return _TOKENS[doc_id].count(term)
def df(term):
"""Number of documents that contain term."""
return sum(1 for toks in _TOKENS.values() if term in toks)
def cf(term):
"""Number of occurrences of term in the whole collection."""
return sum(toks.count(term) for toks in _TOKENS.values())
def doc_len(doc_id):
"""Number of tokens in document doc_id."""
return len(_TOKENS[doc_id])
def avgdl():
"""Average document length in tokens."""
return sum(len(toks) for toks in _TOKENS.values()) / N
test_adaptive_set_intersection.py 145 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/adaptive-set-intersection/. The authors are listed in prov/340HGS.jsonl.
import math
import random
from typing import Any
import irtoy
from adaptive_set_intersection import adaptive_intersect
class Counter:
def __init__(self) -> None:
self.n = 0
class Key:
"""An integer that counts each test it takes part in."""
def __init__(self, v: int, c: Counter) -> None:
self.v, self.c = v, c
def __lt__(self, other: "Key") -> bool:
self.c.n += 1
return self.v < other.v
def __eq__(self, other: object) -> bool:
assert isinstance(other, Key)
self.c.n += 1
return self.v == other.v
def __hash__(self) -> int:
return hash(self.v)
def counted(lists: list[list[int]]) -> tuple[list[int], int, dict[str, Any]]:
c = Counter()
stats: dict[str, Any] = {}
r = adaptive_intersect([[Key(x, c) for x in lst] for lst in lists], stats)
return [k.v for k in r], c.n, stats
def run_bound(stats: dict[str, Any]) -> float:
"""The bound of the proof: 2 r log2(1 + n / r) + 2 r for each list."""
total = 0.0
for r, n in zip(stats["runs"], stats["lengths"]):
if r > 0:
total += 2 * r * math.log2(1 + n / r) + 2 * r
return total
def two_list_bound(la: int, lb: int) -> float:
m, n = min(la, lb), max(la, lb)
if m == 0:
return 0.0
return 2 * m * math.log2(1 + n / m) + 6 * m
def postings() -> dict[str, list[int]]:
index: dict[str, list[int]] = {}
for d in sorted(irtoy.DOCS):
for t in sorted(set(irtoy.tokenize(irtoy.DOCS[d]))):
index.setdefault(t, []).append(d)
return index
def check(lists: list[list[int]]) -> int:
r, n, stats = counted(lists)
expect = sorted(set(lists[0]).intersection(*lists[1:]))
assert r == expect
assert n <= run_bound(stats) + 1e-9
if all(lists):
assert all(x <= stats["eliminators"] for x in stats["runs"])
if len(lists) == 2:
assert n <= two_list_bound(len(lists[0]), len(lists[1])) + 1e-9
if all(lists):
m = min(len(lists[0]), len(lists[1]))
assert n <= 8 * math.log2(math.comb(len(lists[0]) + len(lists[1]), m))
return n
def test_example() -> None:
a = [7, 20, 40]
b = list(range(2, 41, 2))
r, n, stats = counted([b, a])
assert r == [20, 40]
assert n == 22
assert stats["runs"] == [2, 3]
assert stats["eliminators"] == 5
ix = postings()
r, n, stats = counted([ix["sorted"], ix["array"], ix["search"]])
assert r == [1]
r, n, stats = counted([ix["posting"], ix["list"]])
assert r == [3, 4]
def test_irtoy() -> None:
ix = postings()
terms = sorted(ix)
for i, s in enumerate(terms):
for t in terms[i + 1:]:
check([ix[s], ix[t]])
for q in irtoy.QUERIES.values():
check([ix.get(t, []) for t in irtoy.tokenize(q)])
rng = random.Random(35)
for _ in range(300):
check([ix[t] for t in rng.sample(terms, rng.randint(1, 5))])
def test_edges() -> None:
assert adaptive_intersect([[]]) == []
assert adaptive_intersect([[3, 9]]) == [3, 9]
assert adaptive_intersect([[1, 2], []]) == []
assert adaptive_intersect([[4], [4], [4]]) == [4]
assert adaptive_intersect([[1, 2, 3], [1, 2, 3]]) == [1, 2, 3]
assert adaptive_intersect([[1, 3, 5], [2, 4, 6]]) == []
assert adaptive_intersect([[1, 2, 3], [4, 5, 6], [1, 6]]) == []
assert adaptive_intersect([[10], list(range(100))]) == [10]
def test_random_against_sets() -> None:
rng = random.Random(2000)
for _ in range(1200):
u = rng.choice([20, 300, 100000])
a = sorted(rng.sample(range(u), rng.randint(0, min(u, rng.choice([3, 30, 200])))))
b = sorted(rng.sample(range(u), rng.randint(0, min(u, rng.choice([3, 30, 2000])))))
check([a, b])
for _ in range(500):
u = rng.choice([30, 200, 5000])
k = rng.randint(1, 6)
lists = [sorted(rng.sample(range(u), rng.randint(0, min(u, rng.choice([5, 50, 500]))))) for _ in range(k)]
check(lists)
def test_lower_bound_inputs() -> None:
"""Two disjoint lists that interleave in blocks; the count stays within 8 log2 C(m+n, m)."""
rng = random.Random(743)
for _ in range(200):
m = rng.randint(1, 40)
n = rng.randint(m, 2000)
values = list(range(m + n))
chosen = set(rng.sample(values, m))
a = [v for v in values if v in chosen]
b = [v for v in values if v not in chosen]
assert check([a, b]) >= 1
History
Demaine, López-Ortiz and Munro defined the proof of a result of a set operation and its gap cost, and gave the adaptive algorithms for intersection, union and difference at SODA in 2000. They reported experiments with the intersection algorithm for text retrieval at ALENEX in 2001. Barbay and Kenyon gave the Sequential algorithm and its analysis at SODA in 2002, with a journal version in 2008. Barbay, López-Ortiz, Lu and Salinger compared these algorithms with small-versus-small and Baeza-Yates on a log of web queries in 2009.
References
- Erik D. Demaine, Alejandro López-Ortiz and J. Ian Munro, Adaptive set intersections, unions, and differences, Proceedings of the 11th ACM-SIAM Symposium on Discrete Algorithms (SODA 2000), 743-752, Section 3 (proofs of the result, and their gap cost), Section 5 (the intersection algorithm with an eliminator and galloping from both ends), Theorem 5.1 and Corollary 5.2 (O(kG) time and at most 8kG comparisons)
- Erik D. Demaine, Alejandro López-Ortiz and J. Ian Munro, Experiments on adaptive set intersections for text retrieval systems, Algorithm Engineering and Experimentation (ALENEX 2001), Lecture Notes in Computer Science 2153, Springer, 91-104, the experiments with the adaptive intersection algorithm for text retrieval
- Jérémy Barbay and Claire Kenyon, Adaptive intersection and t-threshold problems, Proceedings of the 13th ACM-SIAM Symposium on Discrete Algorithms (SODA 2002), 390-399; journal version in ACM Transactions on Algorithms 4(1), Article 4, 2008, the Sequential algorithm, which searches the eliminator in one set after another, and its analysis
- Jérémy Barbay, Alejandro López-Ortiz, Tyler Lu and Alejandro Salinger, An experimental investigation of set intersection algorithms for text searching, ACM Journal of Experimental Algorithmics 14, Article 3.7, 2009, the description of Adaptive, Small Adaptive, Sequential, SvS and Baeza-Yates, and their comparison on web query logs
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H1 sketch |
|
| Lean | L0 no Lean part |
|
| Code (python) | I0 not checked yet |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag 340HGS Edit this page History Report an error Markdown