Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
0a30e648
Kaydet (Commit)
0a30e648
authored
Tem 20, 2002
tarafından
Tim Peters
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added new test "3sort". This is sorted data but with 3 random exchanges.
It's a little better than average for our sort.
üst
1cfcafce
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
sortperf.py
Lib/test/sortperf.py
+9
-1
No files found.
Lib/test/sortperf.py
Dosyayı görüntüle @
0a30e648
...
...
@@ -74,12 +74,13 @@ def tabulate(r):
*sort: random data
\
sort: descending data
/sort: ascending data
3sort: ascending data but with 3 random exchanges
~sort: many duplicates
=sort: all equal
!sort: worst case scenario
"""
cases
=
(
"*sort"
,
"
\\
sort"
,
"/sort"
,
"~sort"
,
"=sort"
,
"!sort"
)
cases
=
(
"*sort"
,
"
\\
sort"
,
"/sort"
,
"
3sort"
,
"
~sort"
,
"=sort"
,
"!sort"
)
fmt
=
(
"
%2
s
%7
s"
+
"
%6
s"
*
len
(
cases
))
print
fmt
%
((
"i"
,
"2**i"
)
+
cases
)
for
i
in
r
:
...
...
@@ -92,6 +93,13 @@ def tabulate(r):
doit
(
L
)
# \sort
doit
(
L
)
# /sort
# Do 3 random exchanges.
for
dummy
in
range
(
3
):
i1
=
random
.
randrange
(
n
)
i2
=
random
.
randrange
(
n
)
L
[
i1
],
L
[
i2
]
=
L
[
i2
],
L
[
i1
]
doit
(
L
)
# 3sort
# Arrange for lots of duplicates.
if
n
>
4
:
del
L
[
4
:]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment