Skip to content

Commit

Permalink
Fixed bucket sort
Browse files Browse the repository at this point in the history
k is number of buckets, not the maximum number in the input

A proper implementation uses only O(n) of space by using linked lists for
buckets.
  • Loading branch information
nodirt committed Jun 17, 2013
1 parent 9111a19 commit 69f88d4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Tables.html
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ <h2 id="sorting">Sorting</h2>
<td><code class="green">O(1)</code></td>
</tr>
<tr>
<td><a rel="tooltip" title="Only for integers with range k" href="http://en.wikipedia.org/wiki/Bucket_sort">Bucket Sort</a></td>
<td><a rel="tooltip" title="Only for integers. k is a number of buckets" href="http://en.wikipedia.org/wiki/Bucket_sort">Bucket Sort</a></td>
<td>Array</td>
<td><code class="green">O(n+k)</code></td>
<td><code class="green">O(n+k)</code></td>
<td><code class="red">O(n^2)</code></td>
<td><code class="yellow">O(nk)</code></td>
<td><code class="yellow">O(n)</code></td>
</tr>
<tr>
<td><a rel="tooltip" title="Constant number of digits 'k'" href="http://en.wikipedia.org/wiki/Radix_sort">Radix Sort</a></td>
Expand Down

0 comments on commit 69f88d4

Please sign in to comment.