Introduction to Range Query Problems for Beginners [C++]

Правка en1, от Jellyman102, 2020-06-22 19:50:46

Author's Disclaimer: The following content is targeted towards those who are unfamiliar with range queries and how they work. If you are familiar with BITs, segment trees, and prefix sums, you will likely not learn anything new from reading this.

Author's Disclaimer #2: This is my first blog in a series of blogs I plan on writing that introduce various types of problems to beginner competitive programmers. That being said, I am by definition a beginner myself (regardless of my rating or competitive math experience, I have been doing this for less than a year). If you have any suggestions on how these could be improved, don't be afraid to speak up.

Basic Sum Queries (Prefix Sums)

Let's say we have some array $$$A$$$ = $$$A_{1}$$$, $$$A_{2}$$$, ..., $$$A_{n}$$$. Given two indices $$$i$$$ and $$$j$$$, we are tasked to find the following sum.

$$$\sum_{k=i}^{j} A_{k}$$$
Теги #bit, #segment tree, #range query, #c++, #beginner, prefix sum, #math

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en17 Английский Jellyman102 2020-06-23 01:30:06 332
en16 Английский Jellyman102 2020-06-23 00:36:16 0 (published)
en15 Английский Jellyman102 2020-06-23 00:32:28 154
en14 Английский Jellyman102 2020-06-23 00:31:18 123
en13 Английский Jellyman102 2020-06-23 00:29:17 5 Tiny change: 'your BITs 0-based!\n\' -> 'your BITs zero-based!\n\'
en12 Английский Jellyman102 2020-06-23 00:27:14 9 Tiny change: 'or reading thus far. Happy co' -> 'or reading. Happy co'
en11 Английский Jellyman102 2020-06-23 00:26:24 9 Tiny change: 'ng a blog about this sinc' -> 'ng a blog like this sinc'
en10 Английский Jellyman102 2020-06-23 00:25:42 134
en9 Английский Jellyman102 2020-06-23 00:23:26 153
en8 Английский Jellyman102 2020-06-23 00:18:53 2446
en7 Английский Jellyman102 2020-06-23 00:01:27 1668
en6 Английский Jellyman102 2020-06-22 23:37:50 20
en5 Английский Jellyman102 2020-06-22 23:36:53 288
en4 Английский Jellyman102 2020-06-22 23:23:05 68 Tiny change: 'exed tree comes in.' -> 'exed tree (also known as a Fenwick tree) comes in.'
en3 Английский Jellyman102 2020-06-22 23:04:30 978
en2 Английский Jellyman102 2020-06-22 20:18:35 1960 Tiny change: 'p_{j} - dp{i-1}$. ' -> 'p_{j} - dp_{i-1}$. '
en1 Английский Jellyman102 2020-06-22 19:50:46 925 Initial revision (saved to drafts)