Skip to content

Commit

Permalink
Merge pull request #4881 from freakin23/master
Browse files Browse the repository at this point in the history
minor nitpicks
  • Loading branch information
SansPapyrus683 authored Oct 30, 2024
2 parents f9b452a + 972e7ae commit 583dcba
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
4 changes: 4 additions & 0 deletions content/5_Plat/Range_Sweep.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ upper $x$ coordinate of the segment.

Our answer would be the sum of all the queries.

## Implementation

**Time Complexity:** $\mathcal{O}(N\log N)$

<LanguageSection>
<CPPSection>

Expand Down
4 changes: 2 additions & 2 deletions content/5_Plat/Sweep_Line.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ number line?) never explicitly mentioned in module

### Solution 1

**Time Complexity:** $\mathcal{O}(n\log n)$
**Time Complexity:** $\mathcal{O}(N\log N)$

We will use a divide and conquer algorithm. First, sort the points by x-coordinate. Now, let $P$ be the subarray of points in the current step. Then, partition $P$ into two groups $L$ and $R$ representing the left and right halves of $P$. Let $\delta_l$ and $\delta_r$ be the answer of $L$ and $R$ respectively, and define $\delta$ as $\min(\delta_l, \delta_r)$.

Expand Down Expand Up @@ -143,7 +143,7 @@ int main() {
### Solution 2
**Time Complexity:** $\mathcal{O}(n\log n)$
**Time Complexity:** $\mathcal{O}(N\log N)$
Extending Solution 1, we can use a set instead of divide and conquer. Once again, we define $\delta$ as the shortest distance between two points so far. After sorting the points by x-coordinate, we iterate through them while maintaining a running window containing the y-coordinates of all points in $[x-\delta,x]$.
Expand Down
12 changes: 0 additions & 12 deletions content/5_Plat/Sweep_Line.problems.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,18 +165,6 @@
"url": "https://hsin.hr/ceoi2006/tasks/solutions.pdf"
}
},
{
"uniqueId": "cses-1740",
"name": "Intersection Points",
"url": "https://cses.fi/problemset/task/1740",
"source": "CSES",
"difficulty": "Easy",
"isStarred": false,
"tags": ["1DRQ", "Sweep Line"],
"solutionMetadata": {
"kind": "none"
}
},
{
"uniqueId": "poi-18-stone",
"name": "2018 - Stone",
Expand Down

0 comments on commit 583dcba

Please sign in to comment.