FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Python/code/Algorithms/Sorting/selection.py at master · shreydan/Python · GitHub
shreydan
/
Python
Public
Notifications
You must be signed in to change notification settings
Fork
11
Star
18
Code
Issues
2
Pull requests
0
Discussions
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
Python
/
code
/
Algorithms
/
Sorting
/
selection.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
18 lines (13 loc) · 364 Bytes
Breadcrumbs
Python
/
code
/
Algorithms
/
Sorting
/
selection.py
Copy path
File metadata and controls
18 lines (13 loc) · 364 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
14
15
16
17
18
# selection sort
def
selection
(
sortlist
):
""" checks for the largest and then replaces - ascending order only"""
for
i
in
range
(
0
,
len
(
sortlist
)
-
1
):
small
=
sortlist
[
i
]
pos
=
i
for
j
in
range
(
i
+
1
,
len
(
sortlist
)):
if
sortlist
[
j
]
<
small
:
small
=
sortlist
[
j
]
pos
=
j
sortlist
[
pos
]
=
sortlist
[
i
]
sortlist
[
i
]
=
small
;
return
sortlist
Back
|
FazBrowse Home
|
New Git URL