Skip to content

Solving the Top k most frequent words problem using a max-heap#196

Merged
StepfenShawn merged 1 commit intoTheAlgorithms:masterfrom
aparibocci:max_k_most_frequent_words
Feb 10, 2023
Merged

Solving the Top k most frequent words problem using a max-heap#196
StepfenShawn merged 1 commit intoTheAlgorithms:masterfrom
aparibocci:max_k_most_frequent_words

Conversation

@aparibocci
Copy link
Copy Markdown
Contributor

This PR aims to add an algorithm to identify the top k most frequent strings given a provided string list of elements.
To do this, the algorithm is using a max-heap implementation already existing in this repository.

Time complexity is O(n), where n is the number of words:

O(n) for building the max-heap
k*O(logn) for extracting the k most frequent strings

Copy link
Copy Markdown
Member

@StepfenShawn StepfenShawn left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution!

@StepfenShawn StepfenShawn merged commit ecc4507 into TheAlgorithms:master Feb 10, 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