Skip to content
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

Time complexity of floor_sum #101

Closed
rsk0315 opened this issue Jan 19, 2021 · 3 comments · Fixed by #102
Closed

Time complexity of floor_sum #101

rsk0315 opened this issue Jan 19, 2021 · 3 comments · Fixed by #102

Comments

@rsk0315
Copy link
Contributor

rsk0315 commented Jan 19, 2021

The document says O(log(m+a)), but now (by #92) m+a may be negative or zero. I suggest O(log(a mod m)).

By the way, maybe, its complexity could be bounded by O(log(min(n, a mod m))). It might be wrong because I guessed just intuitively (and empirically). So I'm glad if anyone can analyze this.

@rsk0315
Copy link
Contributor Author

rsk0315 commented Jan 19, 2021

Oh. Obviously, a mod m may be zero. 😢

How about O(log((a mod m)+1))?

@rsk0315
Copy link
Contributor Author

rsk0315 commented Jan 20, 2021

O(log(1)) equals O(0), which is not suitable.
O(max(1, log((a mod m)+1))), O(log((a mod m)+2)), or something like that? 😥

... Or, just O(log(m))?

@yosupo06
Copy link
Collaborator

Just O(log m) is enough

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 a pull request may close this issue.

2 participants