Lca va statik rmq o'rtasidagi munosabat



Download 1,02 Mb.
bet3/3
Sana20.06.2022
Hajmi1,02 Mb.
#682471
1   2   3
Bog'liq
Habibullayev A. Algoritimlashdan KURS ISHI

+- RMQ method


Divide the array L in blocks and then precompute minimum in each block. Blocsize is choosen as log (n) /2. This bring time & space complexity to O(n). Sparse table whose time complexity is O(n logn) , replace n by log (n)/2 , we get O(n). For Computing table M, since array L contains 0,1 and is divided in blocks. There can be 2blocksize possible combination. To build each of those combination we need a nested loop that would take blocksize2.
Total time = blocksize2 * 2blocksize , which is O(n) [blocksize = log (n) / 2

RMQ to LCA


RMQ problem can be converted to generalized RMQ problem by first converting it to LCA problem and then can be solved using above way. We use cartesian tree to convert RMQ to LCA
What is Cartesian Tree A tree that can be build from an array which satisfy

  • min-Heap or Max Heap property

  • an inorder travesal yield the orignal array.

This is how we can convert an array into a cartesian tree. 
Reference
Download 1,02 Mb.

Do'stlaringiz bilan baham:
1   2   3




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