Skip to content

Line Sweep algorithm for range problems#4152

Closed
Ltwo3five wants to merge 2 commits intoTheAlgorithms:masterfrom
Ltwo3five:master
Closed

Line Sweep algorithm for range problems#4152
Ltwo3five wants to merge 2 commits intoTheAlgorithms:masterfrom
Ltwo3five:master

Conversation

@Ltwo3five
Copy link
Copy Markdown
Contributor

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized it.
  • All filenames are in PascalCase.
  • All functions and variable names follow Java naming conventions.
  • All new algorithms have a URL in their comments that points to Wikipedia or other similar explanations.

* otherwise.
*/

public static boolean isOverlap(int[][] ranges,int maximum) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is maximum? If it's the biggest point in ranges, it can be derived from ranges and doesn't need to be passed separately

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. I will add logic to get the maximum value(Basically the largest end value in the array)

/** Line Sweep algorithm can be used to solve range problems by first sorting the list of ranges
* by the start value of the range in non-decreasing order and doing a "sweep" through the number
* line(x-axis) by incrementing the start point by 1 and decrementing end point by -1 on the
* number line. https://www.topcoder.com/thrive/articles/Line%20Sweep%20Algorithms
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also add a link to Wikipedia

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

@Ltwo3five
Copy link
Copy Markdown
Contributor Author

I created a feature branch and sent another pull request using that, and will reset my master branch to upstream

@Ltwo3five Ltwo3five closed this Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants