TheAlgorithms / C-Plus-Plus

Collection of various algorithms in mathematics, machine learning, computer science and physics implemented in C++ for educational purposes.
https://thealgorithms.github.io/C-Plus-Plus
MIT License
30.82k stars 7.29k forks source link

Create flash_sort.cpp #2842

Open AkshatPandey2006 opened 1 month ago

AkshatPandey2006 commented 1 month ago

Adding the Flash Sort Algorithm

Description of Change This PR introduces the Flash Sort algorithm under the sorting namespace. Flash Sort is an efficient, distribution-based sorting algorithm that performs exceptionally well on large datasets with uniformly distributed elements. The algorithm partitions the input data into buckets and sorts them locally, leading to better performance compared to traditional sorting algorithms in specific scenarios.

This implementation includes:

Bucket-based distribution of elements based on a linear scaling formula. Local sorting within each bucket to ensure overall sorted order. Handling of edge cases, such as arrays with a single element or identical values, ensuring the algorithm works seamlessly for all input sizes. The implementation also comes with a test suite that verifies the correctness of the algorithm for various data types, including int, float, char, std::string, and std::pair.

Checklist Added description of change Added file name matches File name guidelines Added tests and example, tests must pass Added documentation so that the program is self-explanatory and educational - Doxygen guidelines Relevant documentation/comments are added PR title follows semantic commit guidelines Searched previous suggestions to avoid duplication Acknowledge that all contributions are made under the project's license

Notes: This addition enhances the repository by including an advanced sorting algorithm. Flash Sort offers superior performance in specialized use cases, making it a valuable addition to the collection of sorting techniques.

github-actions[bot] commented 1 week ago

This pull request has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.