Skip to content

Commit 1dc9ec8

Browse files
obelisk0114poyea
authored andcommitted
Update Bucket Sort time complexity analysis (#918)
1 parent f2eb965 commit 1dc9ec8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sorts/bucket_sort.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@
1717
# number of buckets.
1818

1919
# Time Complexity of Solution:
20-
# Best Case O(n); Average Case O(n); Worst Case O(n)
20+
# Worst case scenario occurs when all the elements are placed in a single bucket. The overall performance
21+
# would then be dominated by the algorithm used to sort each bucket. In this case, O(n log n), because of TimSort
22+
#
23+
# Average Case O(n + (n^2)/k + k), where k is the number of buckets
24+
#
25+
# If k = O(n), time complexity is O(n)
2126

2227
DEFAULT_BUCKET_SIZE = 5
2328

0 commit comments

Comments
 (0)