Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7cf18d3

Browse files
committed
type from 'pidgeonhole' to 'pigeonhole' sort
1 parent49248a0 commit7cf18d3

File tree

5 files changed

+10
-11
lines changed

5 files changed

+10
-11
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-
defpidgeonhole_sort(data):
10+
defpigeonhole_sort(data):
1211
minimum=min(data)
1312
size=max(data)-minimum+1
1413
holes= [0]*size

‎docs/readme.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ print(binary_search(arr, 3))
6262
-[Cocktail Shaker Sort](sorting/cocktail-shaker-sort)
6363
-[Insertion Sort](sorting/insertion-sort)
6464
-[Merge Sort](sorting/merge-sort)
65-
-[Pidgeonhole Sort](sorting/pidgeonhole-sort)
65+
-[Pigeonhole Sort](sorting/pigeonhole-sort)
6666
-[Selection Sort](sorting/selection-sort)
6767
-[Stooge Sort](sorting/stooge-sort)
6868

‎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.sortingimportpidgeonhole_sort
14+
from allalgorithms.sortingimportpigeonhole_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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ print(binary_search(arr, 3))
6262
-[Cocktail Shaker Sort](https://python.allalgorithms.com/sorting/cocktail-shaker-sort)
6363
-[Insertion Sort](https://python.allalgorithms.com/sorting/insertion-sort)
6464
-[Merge Sort](https://python.allalgorithms.com/sorting/merge-sort)
65-
-[Pidgeonhole Sort](https://python.allalgorithms.com/sorting/pidgeonhole-sort)
65+
-[Pigeonhole Sort](https://python.allalgorithms.com/sorting/pigeonhole-sort)
6666
-[Selection Sort](https://python.allalgorithms.com/sorting/selection-sort)
6767
-[Stooge Sort](https://python.allalgorithms.com/sorting/stooge-sort)
6868

‎tests/test_sorting.py‎

Lines changed: 2 additions & 2 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,7 +24,7 @@ def test_insertion_sort(self):
2424
deftest_selection_sort(self):
2525
self.assertEqual([-44,1,2,3,7,19],selection_sort([7,3,2,19,-44,1]))
2626

27-
deftest_pidgeonhole_sort(self):
27+
deftest_pigeonhole_sort(self):
2828
self.assertEqual([-44,1,2,3,7,19],pidgeonhole_sort([7,3,2,19,-44,1]))
2929

3030
deftest_stooge_sort(self):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp