Skip to content

Conversation

@Yashaswini-K-P
Copy link

What I changed

  • Replaced the existing sort-based approach for finding the kth minimum element with a priority queue (min-heap) approach.
  • This optimizes the code by reducing the time complexity from O(n log n) to O(n log k), making it more efficient for large inputs, where usually k will be smaller than n

Why

  • Sorting the entire array is unnecessary to find the kth minimum element.
  • Using a priority queue improves performance and reduces runtime for large datasets.

This PR is part of my Hacktoberfest contribution — if valid, could a maintainer please add the hacktoberfest-accepted label? Thank you!

Optimized the code without using sort
@Yashaswini-K-P
Copy link
Author

Hi! This PR is part of my Hacktoberfest contribution.
If valid, could you please add the hacktoberfest-accepted label? Thanks!

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.

1 participant