Skip to content

Commit 51ac5f5

Browse files
authored
Merge pull request abranhe#13 from abranhe/tree
Fix typo from 'pidgeonhole' to 'pigeonhole'
2 parents a8ebdc7 + d8ddec4 commit 51ac5f5

File tree

5 files changed

+27
-17
lines changed

5 files changed

+27
-17
lines changed

allalgorithms/sorting/pidgeonhole_sort.py renamed to allalgorithms/sorting/pigeonhole_sort.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
# -*- coding: UTF-8 -*-
22
#
3-
# Pidgeonhole Sort Algorithm
3+
# Pigeonhole Sort Algorithm
44
# The All ▲lgorithms library for python
55
#
66
# Contributed by: Martmists
77
# Github: @martmists
88
#
99

10-
11-
def pidgeonhole_sort(data):
10+
def pigeonhole_sort(data):
1211
minimum = min(data)
1312
size = max(data) - minimum + 1
1413
holes = [0] * size

docs/readme.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,16 @@ print(binary_search(arr, 3))
5555

5656
# Tree
5757

58-
- Searches
58+
- ### Searches
5959
- [Binary Search](searches/binary-search)
60-
- Sorting
61-
- [Merge Sort](sorting/merge-sort)
60+
- ### Sorting
61+
- [Bubble Sort](sorting/bubble-sort)
62+
- [Cocktail Shaker Sort](sorting/cocktail-shaker-sort)
63+
- [Insertion Sort](sorting/insertion-sort)
64+
- [Merge Sort](sorting/merge-sort)
65+
- [Pigeonhole Sort](sorting/pigeonhole-sort)
66+
- [Selection Sort](sorting/selection-sort)
67+
- [Stooge Sort](sorting/stooge-sort)
6268

6369

6470
# Related

docs/sorting/pidgeonhole-sort.md renamed to docs/sorting/pigeonhole-sort.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Pidgeonhole Sort
1+
# Pigeonhole Sort
22

33
Pigeonhole sorting is a sorting algorithm that is suitable for sorting lists of elements where the number of elements (n) and the length of the range of possible key values (N) are approximately the same. It requires O(n + N) time. It is similar to counting sort, but differs in that it "moves items twice: once to the bucket array and again to the final destination [whereas] counting sort builds an auxiliary array then uses the array to compute each item's final destination and move the item there."
44

@@ -11,17 +11,17 @@ pip install allalgorithms
1111
## Usage
1212

1313
```py
14-
from allalgorithms.sorting import pidgeonhole_sort
14+
from allalgorithms.sorting import pigeonhole_sort
1515

1616
arr = [77, 2, 10, -2, 1, 7]
1717

18-
print(pidgeonhole_sort(arr))
18+
print(pigeonhole_sort(arr))
1919
# -> [-2, 1, 2, 7, 10, 77]
2020
```
2121

2222
## API
2323

24-
### pidgeonhole_sort(array)
24+
### pigeonhole_sort(array)
2525

2626
> Returns a sorted array
2727

readme.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,16 @@ print(binary_search(arr, 3))
5555

5656
# Tree
5757

58-
- Searches
58+
- ### Searches
5959
- [Binary Search](https://python.allalgorithms.com/searches/binary-search)
60-
- Sorting
61-
- [Merge Sort](https://python.allalgorithms.com/sorting/merge-sort)
62-
60+
- ### Sorting
61+
- [Bubble Sort](https://python.allalgorithms.com/sorting/bubble-sort)
62+
- [Cocktail Shaker Sort](https://python.allalgorithms.com/sorting/cocktail-shaker-sort)
63+
- [Insertion Sort](https://python.allalgorithms.com/sorting/insertion-sort)
64+
- [Merge Sort](https://python.allalgorithms.com/sorting/merge-sort)
65+
- [Pigeonhole Sort](https://python.allalgorithms.com/sorting/pigeonhole-sort)
66+
- [Selection Sort](https://python.allalgorithms.com/sorting/selection-sort)
67+
- [Stooge Sort](https://python.allalgorithms.com/sorting/stooge-sort)
6368

6469
# Related
6570

tests/test_sorting.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
insertion_sort,
66
merge_sort,
77
selection_sort,
8-
pidgeonhole_sort,
8+
pigeonhole_sort,
99
stooge_sort,
1010
cocktail_shaker_sort
1111
)
@@ -24,8 +24,8 @@ def test_insertion_sort(self):
2424
def test_selection_sort(self):
2525
self.assertEqual([-44, 1, 2, 3, 7, 19], selection_sort([7, 3, 2, 19, -44, 1]))
2626

27-
def test_pidgeonhole_sort(self):
28-
self.assertEqual([-44, 1, 2, 3, 7, 19], pidgeonhole_sort([7, 3, 2, 19, -44, 1]))
27+
def test_pigeonhole_sort(self):
28+
self.assertEqual([-44, 1, 2, 3, 7, 19], pigeonhole_sort([7, 3, 2, 19, -44, 1]))
2929

3030
def test_stooge_sort(self):
3131
self.assertEqual([-44, 1, 2, 3, 7, 19], stooge_sort([7, 3, 2, 19, -44, 1]))

0 commit comments

Comments
 (0)