Introduction to Algorithms, Third Edition



Download 4,84 Mb.
Pdf ko'rish
bet320/618
Sana07.04.2022
Hajmi4,84 Mb.
#534272
1   ...   316   317   318   319   320   321   322   323   ...   618
Bog'liq
Introduction-to-algorithms-3rd-edition

c.
Argue that any binary search tree has nonnegative potential and that a
1=2
-
balanced tree has potential
0
.
d.
Suppose that
m
units of potential can pay for rebuilding an
m
-node subtree.
How large must
c
be in terms of
˛
in order for it to take
O.1/
amortized time
to rebuild a subtree that is not
˛
-balanced?
e.
Show that inserting a node into or deleting a node from an
n
-node
˛
-balanced
tree costs
O.
lg
n/
amortized time.
17-4
The cost of restructuring red-black trees
There are four basic operations on red-black trees that perform
structural modi-
fications
: node insertions, node deletions, rotations, and color changes. We have
seen that RB-I
NSERT
and RB-D
ELETE
use only
O.1/
rotations, node insertions,
and node deletions to maintain the red-black properties, but they may make many
more color changes.
a.
Describe a legal red-black tree with
n
nodes such that calling RB-I
NSERT
to
add the
.n
C
1/
st node causes
.
lg
n/
color changes. Then describe a legal
red-black tree with
n
nodes for which calling RB-D
ELETE
on a particular node
causes
.
lg
n/
color changes.
Although the worst-case number of color changes per operation can be logarithmic,
we shall prove that any sequence of
m
RB-I
NSERT
and RB-D
ELETE
operations on
an initially empty red-black tree causes
O.m/
structural modifications in the worst
case. Note that we count each color change as a structural modification.
b.
Some of the cases handled by the main loop of the code of both RB-I
NSERT
-
F
IXUP
and RB-D
ELETE
-F
IXUP
are

Download 4,84 Mb.

Do'stlaringiz bilan baham:
1   ...   316   317   318   319   320   321   322   323   ...   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