FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
algorithms-python/algorithms/sort/exchange_sort.py at master · ivan1911/algorithms-python · GitHub
ivan1911
/
algorithms-python
Public
forked from
keon/algorithms
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
algorithms-python
/
algorithms
/
sort
/
exchange_sort.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
11 lines (11 loc) · 330 Bytes
Breadcrumbs
algorithms-python
/
algorithms
/
sort
/
exchange_sort.py
Copy path
File metadata and controls
11 lines (11 loc) · 330 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
def
exchange_sort
(
arr
):
"""
Reference : https://en.wikipedia.org/wiki/Sorting_algorithm#Exchange_sort
Complexity : O(n^2)
"""
arr_len
=
len
(
arr
)
for
i
in
range
(
arr_len
-
1
):
for
j
in
range
(
i
+
1
,
arr_len
):
if
(
arr
[
i
]
>
arr
[
j
]):
arr
[
i
],
arr
[
j
]
=
arr
[
j
],
arr
[
i
]
return
arr
Back
|
FazBrowse Home
|
New Git URL