sparse table

PPTX 11 sahifa 411,9 KB Bepul yuklash

Sahifa ko'rinishi (5 sahifa)

Pastga aylantiring 👇
1 / 11
sparse table sparse table algorithms and data structures course sparse table sparse table is a data structure, that allows answering range queries. it can answer most range queries in , but its true power is answering range minimum queries (or equivalent range maximum queries). for those queries it can compute the answer in time. the only drawback of this data structure is, that it can only be used on immutable arrays. this means, that the array cannot be changed between two queries. if any element in the array changes, the complete data structure has to be recomputed. algorithms and data structures course sparse table idea any non-negative number can be uniquely represented as a sum of decreasing powers of two. this is just a variant of the binary representation of a number. e.g. . for a number x there can be at most summands. by the same reasoning any interval …
2 / 11
table creation because the range of length splits nicely into the ranges and , both of length , we can generate the table efficiently using dynamic programming: the function will depend on the type of query. for range sum queries it will compute the sum, for range minimum queries it will compute the minimum. the time complexity of the precomputation is . algorithms and data structures course sparse table range sum query: idea. for this type of queries, we want to find the sum of all values in a range. therefore the natural definition of the function is . to answer the sum query for the range , we iterate over all powers of two, starting from the biggest one. as soon as a power of two is smaller or equal to the length of the range , we process the first part of range , and continue with the …
3 / 11
mum query is o(1). algorithms and data structures course image110.png image120.png image48.png image1.png image150.png image2.png image170.png image3.png image190.png image200.png image4.png image220.png image5.png /docprops/thumbnail.jpeg
4 / 11
sparse table - Page 4
5 / 11
sparse table - Page 5

Ko'proq o'qimoqchimisiz?

Barcha 11 sahifani Telegram orqali bepul yuklab oling.

To'liq faylni yuklab olish

"sparse table" haqida

sparse table sparse table algorithms and data structures course sparse table sparse table is a data structure, that allows answering range queries. it can answer most range queries in , but its true power is answering range minimum queries (or equivalent range maximum queries). for those queries it can compute the answer in time. the only drawback of this data structure is, that it can only be used on immutable arrays. this means, that the array cannot be changed between two queries. if any element in the array changes, the complete data structure has to be recomputed. algorithms and data structures course sparse table idea any non-negative number can be uniquely represented as a sum of decreasing powers of two. …

Bu fayl PPTX formatida 11 sahifadan iborat (411,9 KB). "sparse table"ni yuklab olish uchun chap tomondagi Telegram tugmasini bosing.

Teglar: sparse table PPTX 11 sahifa Bepul yuklash Telegram