We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f2eb965 commit 1dc9ec8Copy full SHA for 1dc9ec8
sorts/bucket_sort.py
@@ -17,7 +17,12 @@
17
# number of buckets.
18
19
# Time Complexity of Solution:
20
-# Best Case O(n); Average Case O(n); Worst Case O(n)
+# 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)
26
27
DEFAULT_BUCKET_SIZE = 5
28
0 commit comments