Skip to content

hertie-data-science-lab/sortingalgorithms-jvsamson

Repository files navigation

Review Assignment Due Date

Sorting Algorithms

Assignment:

A Bucket sort can use any stable sorting algorithm to sort the elements in its buckets. It can also recursively sort the elements in its buckets into smaller buckets. This is useful when the buckets are still large and unsorted after the first pass of a bucket sort. Rewrite the bucket sort algorithm to call itself until each bucket contains only one element or is already sorted by another algorithm (you may use any stable sorting algorithm).

  • You may use the code provided in this repository as a starting point.
  • You may choose to edit bucket.py or copy the contents into a new file. either way, let me know which is your final submission.
  • Document your code and use modular programming to maximise the quality of your code.

Additional Notes

  • Please do not double-submit. If you are part of a group, do not submit a separate assignment as well.
  • List your group members in the README file or in the header for your submission.
  • Submit by May 8 at 12 am.

Solution:

Our final submission is in the file 'bucket_recursive.py'. We have reworked the original bucket sort algorithm to call itself recursively until each bucket contains only one element or is already sorted by another stable sorting algorithm. We have used modular programming and provided documentation throughout the code to maximize the quality of our work.

The 'bucket_recursive.py' file includes:

  • The bucketSort_recursive function, which is our modified recursive bucket sort algorithm.
  • A test function with various test cases, including positive, negative, decimal, zero, and duplicate values, to demonstrate the functionality of the algorithm.
  • A docstring for the bucketSort_recursive function, explaining its purpose, parameters, return values, and modularity despite having the test function in the same file.

Authors

About

sortingalgorithms-jvsamson created by GitHub Classroom

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages