Question

Section 4.1.3 states “the space required by the array-based list implementation is Ω(n), but can be...

Section 4.1.3 states “the space required by the array-based list implementation is Ω(n), but can be greater.” Explain why this is so.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

I see that you too this statement from https://opendsa-server.cs.vt.edu/ODSA/Books/CS3/html/ListAnalysis.html

as it says "Array-based lists have the disadvantage that their size must be predetermined before the array can be allocated. Array-based lists cannot grow beyond their predetermined size. Whenever the list contains only a few elements, a substantial amount of space might be tied up in a largely empty array. This empty space is the overhead required by the array-based list. Linked lists have the advantage that they only need space for the objects actually on the list. There is no limit to the number of elements on a linked list, as long as there is free store memory available. The amount of space required by a linked list is Θ(n)Θ(n), while the space required by the array-based list implementation is Ω(n)Ω(n), but can be greater."

Example you need to create a list, now you have 2 choices 1. Array 2. LinkedList

The very basic difference between these two is that Array is contagious in memory ie. all element will be stored on subsequent memory locations and hence you need to make this memory allocation well before in future in advance. No new memory allocation is done while storing a new element.

Linked list is non-contagious, means memory is allocated on the fly and a pointer from last element ( called node ) to newly created node is made to keep the track of all elements.

So example you want to store 10 element in list.

taking Array you have to have 10 element space reserved in advance, so made that but now you just have 3 element to store. So space for 7 elements is just lying there unused, in this case space complexity is higher than required.

But if this would have been Linked list, space for only 3 elements would have been used, and further space be allocated dynamically.

Hope this made you understand!!

Add a comment
Know the answer?
Add Answer to:
Section 4.1.3 states “the space required by the array-based list implementation is Ω(n), but can be...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT