Name an advantage of array over linked list?

Answer Posted / sumeet choudhury

Arrays have random access and less overheads compared to
Linked list have sequential access only with too much
overheads and no cache memory support.
On the other hand, arrays allow random access, while linked
lists allow only sequential access to elements. Singly-
linked lists, in fact, can only be traversed in one
direction. This makes linked lists unsuitable for
applications where it's useful to look up an element by its
index quickly, such as heapsort. Sequential access on
arrays is also faster than on linked lists on many machines
due to locality of reference and data caches. Linked lists
receive almost no benefit from the cache.

Another disadvantage of linked lists is the extra storage
needed for references, which often makes them impractical
for lists of small data items such as characters or boolean
values. It can also be slow, and with a naïve allocator,
wasteful, to allocate memory separately for each new
element, a problem generally solved using memory pools.

Is This Answer Correct ?    64 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Give two or more real cenario of virtual function and vertual object

2096


What is the diamond problem in inheritance?

844


Why oops is important?

812


What is the real time example of encapsulation?

814


Why do we use class in oops?

764


What is coupling in oops?

847


How to improve object oriented design skills?

782


Why is it so that we can have virtual constructors but we cannot have virtual destructors?

4376


What is abstraction example?

861


What are the two different types of polymorphism?

918


how to get the oracle certification? send me the answer

1922


What is multilevel inheritance explain with example?

883


What is variable example?

816


What is overloading in oop?

792


What is encapsulation with example?

814