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
program for insertion ,deletion,sorting in double link list
How to hide the base class functionality in Inheritance?
Following are the class specifications: class {int a}; class {int b}; Using friend funtion,calculate the max of two objects and display it.
Who invented oop?
What is a function in oop?
Why is there no multiple inheritance?
What are the three main types of variables?
Is oop better than procedural?
Whats is abstraction in oops?
What is the important feature of inheritance?
What is abstraction with example?
write a code for this. serial_number contained in the header of the file will be read , if this serial number is less than a previous serial number within a successfully processed file, or is the same as another serial number within a successfully processed file, or if the field contains anything other than 7 digits, then the file must error with the reason ‘Invalid SERIAL_NUMBER’.
What is encapsulation with real life example?
What is polymorphism and types?
What does sksksk mean in text slang?