FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
All-Algorithms-In-Python/algorithms/sorting/bogo_sort.py at master · codeme254/All-Algorithms-In-Python · GitHub
codeme254
/
All-Algorithms-In-Python
Public
forked from
AllAlgorithms/python
Notifications
You must be signed in to change notification settings
Fork
1
Star
2
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
All-Algorithms-In-Python
/
algorithms
/
sorting
/
bogo_sort.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
13 lines (10 loc) · 284 Bytes
Breadcrumbs
All-Algorithms-In-Python
/
algorithms
/
sorting
/
bogo_sort.py
Copy path
File metadata and controls
13 lines (10 loc) · 284 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
# Python implementation of Bogo sort
from
random
import
shuffle
def
bogo_sort
(
l
):
while
not
all
(
l
[
i
]
<=
l
[
i
+
1
]
for
i
in
xrange
(
len
(
l
)
-
1
)):
shuffle
(
l
)
return
l
# Tests
if
__name__
==
'__main__'
:
print
bogo_sort
([
3
,
2
,
1
])
print
bogo_sort
([
1000
,
100
,
10
,
1
])
Back
|
FazBrowse Home
|
New Git URL