Bucket-sorting groups collection

Much more efficient than logarithmic approach