Introduction to Algorithms, Third Edition



Download 4,84 Mb.
Pdf ko'rish
bet103/618
Sana07.04.2022
Hajmi4,84 Mb.
#534272
1   ...   99   100   101   102   103   104   105   106   ...   618
Bog'liq
Introduction-to-algorithms-3rd-edition

Part II
Sorting and Order Statistics
Worst-case
Average-case/expected
Algorithm
running time
running time
Insertion sort
‚.n
2
/
‚.n
2
/
Merge sort
‚.n
lg
n/
‚.n
lg
n/
Heapsort
O.n
lg
n/

Quicksort
‚.n
2
/
‚.n
lg
n/
(expected)
Counting sort
‚.k
C
n/
‚.k
C
n/
Radix sort
‚.d.n
C
k//
‚.d.n
C
k//
Bucket sort
‚.n
2
/
‚.n/
(average-case)
Order statistics
The
i
th order statistic of a set of
n
numbers is the
i
th smallest number in the set.
We can, of course, select the
i
th order statistic by sorting the input and indexing
the
i
th element of the output. With no assumptions about the input distribution,
this method runs in
.n
lg
n/
time, as the lower bound proved in Chapter 8 shows.
In Chapter 9, we show that we can find the
i
th smallest element in
O.n/
time,
even when the elements are arbitrary real numbers. We present a randomized algo-
rithm with tight pseudocode that runs in
‚.n
2
/
time in the worst case, but whose
expected running time is
O.n/
. We also give a more complicated algorithm that
runs in
O.n/
worst-case time.
Background
Although most of this part does not rely on difficult mathematics, some sections
do require mathematical sophistication. In particular, analyses of quicksort, bucket
sort, and the order-statistic algorithm use probability, which is reviewed in Ap-
pendix C, and the material on probabilistic analysis and randomized algorithms in
Chapter 5. The analysis of the worst-case linear-time algorithm for order statis-
tics involves somewhat more sophisticated mathematics than the other worst-case
analyses in this part.



Download 4,84 Mb.

Do'stlaringiz bilan baham:
1   ...   99   100   101   102   103   104   105   106   ...   618




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish