Comparison Between Array and Dictionary

# Array Dictionary 
1 Stores just a set of objects Represents the relationship between pair of objects
2

Lookup time is more in the  case of array O(N) 

where N is the size of the array

Lookup time is less compared to an array.

Generally, it is O(1) 

3 Elements are stored at contiguous memory locations. Elements may or may not be stored at a contiguous memory location.
4 Items are unordered, changeable, and do allow duplicates Items are ordered, changeable, and do not allow duplicates
5 Items are not represented as key: value pair Items are represented as key: value pair
6 The values in the array are of the same data type The values in dictionary items can be of any data type
7 Values can be accessed randomly without the need for any key To access a value the key is required 


Differences between Array and Dictionary Data Structure

Similar Reads

Arrays:

The array is a collection of the same type of elements at contiguous memory locations under the same name.  It is easier to access the element in the case of an array.  The size is the key issue in the case of an array which must be known in advance so as to store the elements in it.  Insertion and deletion operations are costly in the case of an array since the elements are stored at contiguous memory locations.  No modification is possible at the runtime after the array is created and memory wastage can also occur if the size of the array is greater than the number of elements stored in the array....

Dictionary:

...

Comparison Between Array and Dictionary:

...

Contact Us