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 max_table method to CRP #222

Merged
merged 2 commits into from
Oct 3, 2024
Merged

Conversation

ThomasColthurst
Copy link

and use it to make the code more understandable and more efficient.

Also, switch the table_weights() return values from unordered_map's to map's, so that their maximum key can be compute in O(1) time.

Copy link

@emilyfertig emilyfertig left a comment

Choose a reason for hiding this comment

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

Why do you figure they used unordered_map here?

@ThomasColthurst
Copy link
Author

Why do you figure they used unordered_map here?

Probably that was their default (for the slight efficiency win over map?), and then when they added the table_weights methods they didn't realize that map<> would be more efficient.

@ThomasColthurst ThomasColthurst merged commit 9ab0e4f into master Oct 3, 2024
2 checks passed
@ThomasColthurst ThomasColthurst deleted the 021024-thomaswc-crp_max branch October 3, 2024 19:44
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