Computer science
Arrays
what is an advantage of arrays over linked lists?

Asked by
jstamou2@villanova.edu
Last updated by
Jill W
what is an advantage of arrays over linked lists?
"Any element in an array can be directly accessed with its index; however in the case of a linked list, all the previous elements must be traversed to reach any element. Also, better cache locality in arrays (due to contiguous memory allocation) can significantly improve performance. As a result, some operations (such as modifying a certain element) are faster in arrays, while others (such as inserting/deleting an element in the data) are faster in linked lists."
geeksforgeeks.org/linked-list-vs-array