Breaking

Tuesday, September 3, 2019

What is the difference between an ARRAY and a LIST?

Arrays
An array is an ordered collection of items, where each item inside the array has an index.
Taking the one dimensional array one step further, we can have arrays with two (or even more) dimensions.
Lists
It’s a collection of items (called nodes) ordered in a linear sequence.
There is a general theoretical programming concept of a list, and there is the specific implementation of a list data structure, which may have taken this basic list idea and added a whole bunch of functionality. Lists are implemented either as linked lists (singly, doubly, circular, …) or as dynamic (re-sizable) array.
Linked List
An Array Vs A List
A list is a different kind of data structure from an array.
The biggest difference is in the idea of direct access Vs sequential access. Arrays allow both; direct and sequential access, while lists allow only sequential access. And this is because the way that these data structures are stored in memory.
In addition, the structure of the list doesn’t support numeric index like an array is. And, the elements don’t need to be allocated next to each other in the memory like an array is.

No comments:

Post a Comment