Skip to content

Conversation

@izanbf1803
Copy link
Contributor

@izanbf1803 izanbf1803 commented Jun 24, 2025

The new explanation adds two randomized algorithms that have linear expected runtime. One of them being much simpler to implement and remember than the traditional divide and conquer algorithm, and improving its runtime efficiency. An implementation for the first one is provided. An image is included to clarify the strategy of the first randomized algorithm.

Explanation of randomized algorithms for closest pair of points.
@izanbf1803
Copy link
Contributor Author

@adamant-pwn Please someone check this PR!

@mhayter
Copy link
Contributor

mhayter commented Jun 28, 2025

Wow, this is a significant contribution !Thank you. I'll try to read this soon and give input.

@mhayter
Copy link
Contributor

mhayter commented Jun 28, 2025

Some of the math @jxu might be good at too in addition to @adamant-pwn.

Briefly, the last expressions are not rendering properly. That might be a spacing issue:

$$O(n + \sum_{i=1}^{n} i \Pr(X_i = 1)) \le O(n + \sum_{i=1}^{n} i \frac{2}{i}) = O(3n) = O(n) \quad \quad \blacksquare $$

Lol it works in GitHub haha.

Quick edits. Rendering
@mhayter
Copy link
Contributor

mhayter commented Jun 28, 2025

Given the complexity, it may make sense to add basic tests to our suite.

Personally, I'd prefer proofs to be in one of those drop downs as I'm not as mathematically inclined and am likely to skip over it unless I'm really interested.

It's probably prudent to include the worst case time and scenarios in which they fail expectation.

The math claims will likely require hours to really sit down and verify for me but I'm hoping some of the other guys can chime in.

PS I'm not sure if we've standardized the site as American English or British English spellings ( I noticed practise vs practice.)

@izanbf1803
Copy link
Contributor Author

izanbf1803 commented Jun 28, 2025

Thanks for the useful changes @mhayter !!! I think I fixed the issue with the equation, block equations need to be surrounded by newlines apparently. How could this thing of having a dropdown for the proof be implemented? (EDIT: done!)

@mhayter
Copy link
Contributor

mhayter commented Jun 28, 2025

The current code does not compile: candidate_closest does not exist.

Also, I'd consider accepting references in the dist function and also changing the name of dis generator as it looks very similar.

izanbf1803 and others added 2 commits August 23, 2025 15:27
Replace "cube" with "square"

Co-authored-by: Oleksandr Kulkov <adamant.pwn@gmail.com>
Better formatting

Co-authored-by: Oleksandr Kulkov <adamant.pwn@gmail.com>
@mhayter
Copy link
Contributor

mhayter commented Sep 27, 2025

Are there any other changes required? @adamant-pwn

@izanbf1803
Copy link
Contributor Author

Ping :)

Copy link
Member

@adamant-pwn adamant-pwn left a 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 patience! 🙏

I think the current version looks good, it should be ok to merge. Thanks a lot!

@adamant-pwn adamant-pwn merged commit dfbbe2b into cp-algorithms:main Oct 7, 2025
3 checks passed
github-actions bot added a commit that referenced this pull request Oct 7, 2025
@mhayter
Copy link
Contributor

mhayter commented Oct 10, 2025

Congrats @izanbf1803 and @adamant-pwn !

@izanbf1803
Copy link
Contributor Author

Thanks @mhayter and @adamant-pwn for helping me improve it! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants