1,449 views

2 Answers

Best answer
9 votes
9 votes

Answer and Explanation 

According to the concept of Spatial Locality, if the data in location 'n' is accessed, there is a high chance that the data in location 'n+1' will be accessed soon. Therefore, several contiguous memory blocks are loaded onto the machine's cache to speed up the data access. Since arrays are stored in a contiguous manner, they are best suited for this and thereby improving performance.

selected by
1 votes
1 votes

All the elements of array are placed in consecutive memory location, unlike linked list, whose every element is placed at random location.

While accessing memory, memory management system always fetch block of words in cache from memory, so in one block fetch, CPU can get many array elements in one block.

locality of reference: is a term for the phenomenon in which the same values, or related storage locations, are frequently accessed

Related questions

3 votes
3 votes
1 answer
1
KISHALAY DAS asked Dec 11, 2016
1,354 views
1 votes
1 votes
1 answer
2
Mrityudoot asked Feb 2
247 views
In what cases does an uninitialized array have values = 0 and for which cases does it have values = garbage values. How to differentiate?
1 votes
1 votes
1 answer
3
Mrityudoot asked Feb 2
131 views
Does C support fractional Indices?float x = some fraction;Is float a[x] valid declaration?
1 votes
1 votes
1 answer
4
amitarp818 asked Oct 25, 2023
408 views
How is the address written for 3-dimensional arrays?In some answers, I saw (row, column, frame) and in others, it was (frame, row, column) Which one to follow??Also, how ...