FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
algorithm/005B_QuickSort_MultipleEqualElements.py at master · lixinchn/algorithm · GitHub
lixinchn
algorithm
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
algorithm
/
005B_QuickSort_MultipleEqualElements.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
37 lines (30 loc) · 883 Bytes
Breadcrumbs
algorithm
/
005B_QuickSort_MultipleEqualElements.py
Copy path
File metadata and controls
37 lines (30 loc) · 883 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
30
31
32
33
34
35
36
37
import
random
class
QuickSortE
():
def
__init__
(
self
):
self
.
data
=
[
3
,
1
,
1
,
2
,
2
,
1
,
1
,
2
,
3
,
2
,
5
,
2
,
4
,
2
,
1
,
3
,
4
]
def
do
(
self
):
low
,
high
=
0
,
len
(
self
.
data
)
-
1
self
.
sort
(
self
.
data
,
low
,
high
)
def
sort
(
self
,
data
,
low
,
high
):
if
low
>=
high
:
return
i
=
low
lt
,
gt
=
low
,
high
flag
=
data
[
low
]
while
i
<=
gt
:
if
data
[
i
]
>
flag
:
data
[
i
],
data
[
gt
]
=
data
[
gt
],
data
[
i
]
gt
-=
1
continue
if
data
[
i
]
<
flag
:
data
[
i
],
data
[
lt
]
=
data
[
lt
],
data
[
i
]
i
+=
1
lt
+=
1
continue
i
+=
1
self
.
sort
(
data
,
low
,
lt
-
1
)
self
.
sort
(
data
,
gt
+
1
,
high
)
if
__name__
==
'__main__'
:
qse
=
QuickSortE
()
qse
.
do
()
print
qse
.
data
Back
|
FazBrowse Home
|
New Git URL