For example, an array is a datatype which is widely implemented as a default type, in most of the modern programming languages, which are used to store data of similar type. But, there are many cases, like the one where we don't know the quantity of data to be stored, for which some other data structures like Linked Lists can be used.
The following are some of the differences between Arrays and Linked Lists:
Arrays Linked Lists An array is a collection of elements of a similar data type. Linked List is an ordered collection of elements of the same type in which each element is connected to the next using pointers. Array elements can be accessed randomly using the array index. Random accessing is not possible in linked lists. The elements will have to be accessed sequentially. Data elements are stored in contiguous locations in memory. New elements can be stored anywhere and a reference is created for the new element using pointers. Insertion and Deletion operations are costlier since the memory locations are consecutive and fixed. Insertion and Deletion operations are fast and easy in a linked list. Memory is allocated during the compile time (Static memory allocation). Memory is allocated during the run-time (Dynamic memory allocation). Size of the array must be specified at the time of array declaration/initialization. Size of a Linked list grows/shrinks as and when new elements are inserted/deleted.