Skip to content

Commit

Permalink
Update Sorting_Custom.mdx
Browse files Browse the repository at this point in the history
  • Loading branch information
SansPapyrus683 authored Oct 31, 2024
1 parent c1ce7db commit 0530578
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions content/3_Silver/Sorting_Custom.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -858,11 +858,11 @@ We also provide a more detailed explanation:
First of all, let's figure out the value at each index in array $a$. It would be
too slow to loop through every index in every update interval as well as every
index in a query interval (The time complexity would be
$O(N \cdot max_c + Q
\cdot max_c)$ where $max_c$ is the maximum coordinate given
in the input, which is up to $10^9$.). At the same time, that approach would
take $O(max_c)$ memory, which is also too much. Instead, we make an observation
index in a query interval
(The complexity would be $O(C(N+Q))$,
where $C$ is the maximum coordinate given in the input).
At the same time, that approach would take $O(C)$ memory, which is also too much.
Instead, we make an observation
that will make prefix sums paired with coordinate compression a viable option.
Not every index in the whole range from $1...10^9$ is used in updates. In fact,
Expand Down

0 comments on commit 0530578

Please sign in to comment.