File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 3
3
# This program will illustrate how to implement bucket sort algorithm
4
4
5
5
# Wikipedia says: Bucket sort, or bin sort, is a sorting algorithm that works by distributing the
6
- # elements of an array into a number of buckets. Each bucket is then sorted individually, either using
6
+ # elements of an array into a number of buckets. Each bucket is then sorted individually, either using
7
7
# a different sorting algorithm, or by recursively applying the bucket sorting algorithm. It is a
8
8
# distribution sort, and is a cousin of radix sort in the most to least significant digit flavour.
9
9
# Bucket sort is a generalization of pigeonhole sort. Bucket sort can be implemented with comparisons
14
14
# Best Case O(n); Average Case O(n); Worst Case O(n)
15
15
16
16
from __future__ import print_function
17
- from P26_InsertionSort import insertionSort
17
+ from insertion_sort import insertion_sort
18
18
import math
19
19
20
20
DEFAULT_BUCKET_SIZE = 5
@@ -46,7 +46,7 @@ def bucketSort(myList, bucketSize=DEFAULT_BUCKET_SIZE):
46
46
# Sort buckets and place back into input array
47
47
sortedArray = []
48
48
for i in range (0 , len (buckets )):
49
- insertionSort (buckets [i ])
49
+ insertion_sort (buckets [i ])
50
50
for j in range (0 , len (buckets [i ])):
51
51
sortedArray .append (buckets [i ][j ])
52
52
You can’t perform that action at this time.
0 commit comments