-
Notifications
You must be signed in to change notification settings - Fork 480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Eulers_Formula.mdx #4801
base: master
Are you sure you want to change the base?
Conversation
Gave Introduction and modified the examples.
for more information, see https://pre-commit.ci
<Resources> | ||
<Resource | ||
source="MIT" | ||
title=" MIT Course Notes" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
weird formatting
@@ -11,19 +11,215 @@ frequency: 1 | |||
|
|||
## Introduction | |||
|
|||
<IncompleteSection /> | |||
A planar graph is a graph that can be drawn on a plane without any edges crossing. In other words, it can be embedded in the plane such that no two edges intersect except at their endpoints. Planar graphs can be represented in a two-dimensional space without overlaps between edges. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
third sentence is redundant
|
||
Euler's Formula states that any correct embedding of a connected planar graph satistfies:- | ||
|
||
<center><h1>V − E + F = 2</h1></center> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use double dollar signs for latex
|
||
<center><h1>V − E + F = 2</h1></center> | ||
|
||
Where V is the no of vertices, E is the number of edges and F is the number of faces. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use latex for these variables
**Memory Complexity:** $\mathcal{O}(N \log N)$ | ||
|
||
```cpp | ||
#include "rainbow.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rainbow.h?
```cpp | ||
#include "rainbow.h" | ||
#include <bits/stdc++.h> | ||
#define FOR(i, x, y) for (int i = x; i < y; i++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no macros
#define FOR(i, x, y) for (int i = x; i < y; i++) | ||
using namespace std; | ||
|
||
const int MAXN = 2e5, MAXSEG = (6e5 + 9) * 19 + 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maxseg?
int E = | ||
edges_horiz.query(ar + 1, br, ac, bc) + edges_vert.query(ar, br, ac + 1, bc); | ||
int V = vertices.query(ar + 1, br, ac + 1, bc); | ||
int R = rivers.query(ar, br, ac, bc); | ||
int C = (ar >= mn_r || br <= mx_r || ac >= mn_c || bc <= mx_c ? 1 : 2); | ||
return E - V + C - R; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use lowercase variable names
|
||
## Example 2 | ||
|
||
<Problems problems="e2" /> | ||
|
||
<IncompleteSection /> | ||
# Explanation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this h1
Made changes according to your advice.
for more information, see https://pre-commit.ci
<center> $$ V − E + F = 2 $$ </center> | ||
|
||
$$ V = Vertices $$ | ||
|
||
$$ E = Edges $$ | ||
|
||
$$ F = Faces $$ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you...check how this looks in the markdown renderer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I will change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any other changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we'll see
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for your contribution!
In this problem, we're asked to count the number of contiguous areas of cells on | ||
several flat rectangles. Such areas are separated by river segments and | ||
rectangle boundaries. | ||
|
||
Where else do we count the number of areas on a flat surface? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this problem, we're asked to count the number of contiguous areas of cells on | |
several flat rectangles. Such areas are separated by river segments and | |
rectangle boundaries. | |
Where else do we count the number of areas on a flat surface? | |
In this problem, we're given a 2D grid with a river segment (path) running through it. Our task is to count the number of contiguous areas of non-river cells on $Q$ subrectangles in this grid. | |
That's the definition of a planar graph! How can we calculate the number of segments on this plane? |
wording is confusing on this part. it might be better to not restate the problem at all
Finding $E$, $V$, and $R$ is a lot more complicated though. | ||
|
||
### Finding $E$, $V$, and $R$ | ||
|
||
To find $E$, $V$, and $R$, we can use a data structure that can handle 2D range | ||
queries efficiently. | ||
|
||
However, the coordinates of the grid can get very large, so a simple 2D BIT or | ||
segment tree won't work here. | ||
|
||
To work around this, we can either use a 2D BIT with coordinate compression or a | ||
persistent segment tree. See the sections on | ||
[offline 2D sum queries](/plat/2DRQ#2d-offline-sum-queries) or | ||
[persistent segment trees](/adv/persistent) for more details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be useful to tell the user why we need 2d range queries.
also you don't need to split this into another section.
|
||
<IncompleteSection /> | ||
**Memory Complexity:** $\mathcal{O}(N \log N)$ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
**Memory Complexity:** $\mathcal{O}(N \log N)$ |
|
||
```cpp | ||
|
||
const int MAXN = 2e5, MAXSEGMENT = (6e5 + 9) * 19 + 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
separate with underscore: MAX_N
|
||
int cnt = 1, segtree[MAXSEGMENT], left_c[MAXSEGMENT], right_c[MAXSEGMENT]; | ||
|
||
struct Segtree { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you use the one from the module & codesnip it?
|
||
**Time Complexity:** $\mathcal{O}(N^2 \log N)$ | ||
|
||
**Memory Complexity:** $\mathcal{O}(N^2)$ | ||
|
||
```cpp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok this entire code block needs to be rewritten -- we want the code to be as readable /easy-to-understand as possible. so this means removing templates/macros
Gave Introduction and modified the examples.
Place an "x" in the corresponding checkbox if it is done or does not apply to this pull request.