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

added counting sort #413

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

added counting sort #413

wants to merge 1 commit into from

Conversation

indshree
Copy link

PR Title

Added Counting Sort Algorithm in Python

Summary

Implemented the Counting Sort algorithm using a class-based approach in Python. The algorithm efficiently sorts non-negative integers by counting occurrences and using a cumulative sum approach.

Description

This PR introduces a CountingSort class that sorts an array using the Counting Sort algorithm. The algorithm is efficient for sorting numbers within a limited range.

The changes are as follows:

  • Implemented a class-based CountingSort algorithm
  • Ensured the sorting method works for non-negative and negative integers
  • Included a get_sorted_array() method to retrieve the sorted list
  • Added an example usage demonstrating the algorithm in action

Checks

In the repository

  • Made no changes that degrade the functioning of the repository
  • Gave each commit a better title (e.g., "Added Counting Sort Implementation")

In the PR

  • Followed the format of the pull_request_template
  • Made the Pull Request small and focused
  • Tested the changes to ensure correctness

Thank You,
Shruti Shree

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