What are the Difference Between Array and Linked List ?
Welcome to the Tech Fantastik. Today we are going to learn about Array and Linked List and their differences also. Array and Linked List are the main part of Data Structure. Let's see the basics of Data Structure first..
| Difference Between Array and Linked List |
What is Data Structure ?
Data Structure is the way organizing the data in memory such that program execute in efficient manner . In simple language Data Structure is method to Store the data such that it consume the minimum amount of memory in order to increase the efficiency of program.
There are more methods to store Data.
1 ) Array
2 ) Linked List
3 ) Stack
4 ) Queue
Here we will be discussing only about Array and Linked Lists. So let's start..
What Is Array ??
Array is container which stores the Data of same Data Type in successive memory locations . Array size is fixed once it intialized. Array provides the faster updation and retrieval of data because data are stored in consecutive memory locations.
| Array Representation | Image Source : Medium.com|| |
What Is Linked List ?
Linked List is also used to store the data but the data are not stored in consecutive memory locations . Data are stored on different different memory locations and connected by pointers which contains the address of memory locations of next elements. It is represented by node . NODE is divided into two parts
1) Head : Head part contains the data
2)Tail : Tail part contains the address of next memory location
| Linked List Representation|
What Is the difference between Array and Linked List ?
1. An array is a collection of similar type data elements whereas the Linked list is a collection of unordered linked nodes.
2. In the array the elements belong to indexes whereas in a linked list traversing start from the head through until desired element is found.
3. Accessing an element in an array is fast, while in a Linked list it is quite a bit slower.
4. Operations like insertion, deletion in arrays consume a nked lists.
5. Arrays are of fixed size whereas Linked lists are dynamic and flexible.
6. Memory is assignment is done during compile time in Array while in a Linked list memory allocated during execution or runtime.
7. The requirement of memory is less in the array whereas in Linked Lists additional memory is required to store of additional next and previous referencing elements.
8. Memory utilization is inefficient in the array whereas memory utilization is efficient in the linked list.
I hope you understood the basic concepts of Array and Linked List . And what are the differences between them .
Read also : Top 15 Free online Programming Courses
If find this post helpful then share this posts among your friends.