Friday 11 August 2017

What is list in data structure

List: - List is a linear data structure in which elements are arranged in random order. That means list is those type of linear data structure in which elements are arranged neither LIFO nor FIFO. List is implemented using array and link list.

Array has various disadvantages to handle huge no of data item in linear form. The size of array is fixed. So, memory block can be in sufficient as the requirement of the user. It is also possible that the blocks are huge in compression with the requirement of the user, So the chances of memory wastage can be maximum. 
                      
Insertion operation in array is very time consuming operation due to right shift. Operation of all elements present in the right side of the insertion point.

Similarly deletion operation in array is also a very time consuming operation due to left shift, operation of all elements present in the right side of the deletion point.

To remove the disadvantages of array, two new concepts are arise:- Dynamic memory allocation and concept of link list.

Dynamic memory allocation is those type of memory allocation process by which we can allocate memory for the variables at the time of execution using the function malloc, calloc and realloc. Using the concept of dynamic memory allocation the concept of insufficient memory and a huge memory of array can be removed. Using dynamic memory allocation user can allocate specific number of blocks for a variable as the requirement of the user. There are no chances of memory wastage or extra memory for wastage. 
 
To remove the disadvantages of array related to insertion and deletion operation. The concept of link list is arise. Link list is a linear data structure in which elements can be inserted or deleted in any order without shift operation and they are connected to each other using pointers.

This program solved by Ms Aakriti Srivastav (Guided by Jitendra Kumar JAVA Trainer at Vtech Academy of Computers)- C | C++ | DS | JAVA | Android | Python & Oracle

What is list in data structure

List: - List is a linear data structure in which elements are arranged in random order. That means list is those type of linear data struc...