FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
allalgorithms-python/allalgorithms/sorting/shell_sort.py at master · Zahgon/allalgorithms-python · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
Zahgon
/
allalgorithms-python
Public
forked from
abranhe/allalgorithms-python
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
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
allalgorithms-python
/
allalgorithms
/
sorting
/
shell_sort.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
30 lines (21 loc) · 490 Bytes
Breadcrumbs
allalgorithms-python
/
allalgorithms
/
sorting
/
shell_sort.py
Copy path
File metadata and controls
30 lines (21 loc) · 490 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
19
20
21
22
23
24
25
26
27
28
29
# -*- coding: UTF-8 -*-
#
# Shell Sort Algorithm
# The All ▲lgorithms library for python
#
# Contributed by: Elias
# Github: @eliasbayona
#
def
shell_sort
(
arr
):
n
=
len
(
arr
)
h
=
int
(
n
/
2
)
while
h
>
0
:
for
i
in
range
(
h
,
n
):
temp
=
arr
[
i
]
j
=
i
while
j
>=
h
and
arr
[
j
-
h
]
>
temp
:
arr
[
j
]
=
arr
[
j
-
h
]
j
-=
h
arr
[
j
]
=
temp
h
=
int
(
h
/
2
)
return
arr
Back
|
FazBrowse Home
|
New Git URL