Titsjgrosdnle Here



Download 134,23 Kb.
bet2/3
Sana16.06.2022
Hajmi134,23 Kb.
#677148
1   2   3
Bog'liq
kilich 3

4) insert(): Inserting a new key takes O(Logn) time. We add a new key at the end of the tree. IF new key is greater than its parent, then we don’t need to do anything. Otherwise, we need to traverse up to fix the violated heap property.

4) insert(): Inserting a new key takes O(Logn) time. We add a new key at the end of the tree. IF new key is greater than its parent, then we don’t need to do anything. Otherwise, we need to traverse up to fix the violated heap property.

5) delete(): Deleting a key also takes O(Logn) time. We replace the key to be deleted with minum infinite by calling decreaseKey(). After decreaseKey(), the minus infinite value must reach root, so we call extractMin() to remove the key.

Decrease or increase key

The decrease key operation replaces the value of a node with a given value with a lower value, and the increase key operation does the same but with a higher value. This involves finding the node with the given value,

changing the value, and then down-heapifying or up-heapifying to restore the heap property.

changing the value, and then down-heapifying or up-heapifying to restore the heap property.

Decrease key can be done as follows:

Summary of running times


Operation

find-min

delete-min

insert

decrease-key

meld

Binary[17]

Θ(1)

Θ(log n)

O(log n)

O(log n)

Θ(n)

Leftist

Θ(1)

Θ(log n)

Θ(log n)

O(log n)

Θ(log n)

Binomial[17][18]

Θ(1)

Θ(log n)

Θ(1)[c]

Θ(log n)

O(log n)[d]

Fibonacci[17][19]

Θ(1)

O(log n)[c]

Θ(1)

Θ(1)[c]

Θ(1)

Pairing[20]

Θ(1)

O(log n)[c]

Θ(1)

o(log n)[c][e]

Θ(1)

Brodal[23][f]

Θ(1)

O(log n)

Θ(1)

Θ(1)

Θ(1)

Rank-pairing[25]

Θ(1)

O(log n)[c]

Θ(1)

Θ(1)[c]

Θ(1)

Strict Fibonacci[26]

Θ(1)

O(log n)

Θ(1)

Θ(1)

Θ(1)

2–3 heap[27]

O(log n)

O(log n)[c]

O(log n)[c]

Θ(1)

?

Download 134,23 Kb.

Do'stlaringiz bilan baham:
1   2   3




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©www.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