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

Add primes example #15

Merged
merged 1 commit into from
Sep 9, 2019
Merged

Add primes example #15

merged 1 commit into from
Sep 9, 2019

Conversation

ben-clayton
Copy link
Contributor

Demonstrates the use of marl::Ticket::Queue.


// isPrime returns true if i is prime.
bool isPrime(int i) {
for (int j = 2; j < i; j++) {

Choose a reason for hiding this comment

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

I know this is simply example code, and efficiency is not actually your goal, but my brain would much prefer at least j < sqrt(i). I would not hold this back, as its not the point of the example, and for the same performance you would need a much larger searchMax.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. I was on the fence about this, and you've pushed me over.

Demonstrates the use of marl::Ticket::Queue.
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