Linear Data Structures



Download 0,87 Mb.
bet4/4
Sana10.07.2022
Hajmi0,87 Mb.
#768147
1   2   3   4
Bog'liq
Data Structure with Mosh

Insert O(n), which means the cost of copying these items into the new array increases linearly and in direct proportion to the size of the array. Now let’s talk about removing an item. If you want to remove the last item, that’s pretty easy. We can quickly look it up by its index and clear the memory. So here we have Delete O(1), which is our best case scenario.

But when doing big O analysis, we should think about the worst case scenario. What is the worst case scenario here? This is when we want to remove an item from the beginning of the array. We have to shift all the items on the right one step to the left to fill in the hole. The more items we have, the more this shifting operation is going to cost. So for the worst case scenario, deletion is an all off and operation.

So because arrays have a fixed size in situations where we don’t know ahead of time how many items we want to store in them or when we need to add or remove a lot of items form them, they don’t perform well. In those cases we use LinkedLists.




Download 0,87 Mb.

Do'stlaringiz bilan baham:
1   2   3   4




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