Algorithms and Data Structures · Senior · Question 71 of 75

What does the "sparse table" structure answer in O(1)?

Explanation

It precomputes minimums of all ranges of length 2ᵏ in O(n log n). Any range is covered by two overlapping power-of-two ranges, and min doesn't care about overlap. Updates would require rebuilding.

Further reading

Problem with a question

Algorithms and Data Structures · Senior · question 71

Test yourself

Take the Algorithms and Data Structures · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz