Two types of implementation for Data structures

a. Array Implementation: This uses static structures that are determined during the compilation process. Memory is allocated at compile time.

Advantages of Arrays:
1. Searching an array for an individual element is efficient.
2. Less time taken than Lists for searching an element.

Disadvantages of Arrays:
1. Fixed in size: Once an array is created, the size of the array cannot be increased or decreased.
2. Wastage of space: If the number of elements is less, leads to wastage of space.


3. Sequential Storage: Array elements are stored in contiguous memory locations. At the times it might so happen that enough contiguous locations might not be available. Even though the total space requirement of an array can be met through a combination of non-contiguous blocks of memory, we would still not be allowed to create the array.
4. The possibility of overflow: If the program ever needs to process more than the size of the array, there is a possibility of overflow and code breaks.
5. Difficulty in insertion and deletion: In case of insertion of a new element, each element after the specified location has to be shifted one position to the right. In case of deletion of an element, each element after the specified location has to be shifted one position to the left.

b. A pointer or Linked List Implementation: This uses dynamic structures that are determined during the execution of the program. Memory is allocated dynamically during execution.


Thanks
Mukesh Rajput
Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments:

Thanks
Mukesh Rajput