Skip to content

Instantly share code, notes, and snippets.

@jaye-ross
jaye-ross / bs.py
Created November 22, 2022 02:50
Bucket sort of List[int] in python
"""
Bucket sort (of type List[int])
"""
from itertools import chain
from typing import List
def bucket_sort(somelist: List[int], n_buckets: int = None, approximate: bool = False):
if n_buckets is None:
n_buckets = int(len(somelist) ** 0.5)