Open In App

Static Data Structure vs Dynamic Data Structure

Data structure is a way of storing and organizing data efficiently such that the required operations on them can be performed be efficient with respect to time as well as memory. Simply, Data Structure are used to reduce complexity (mostly the time complexity) of the code. Data structures can be two types : 1. Static Data Structure 2. Dynamic Data Structure 

What is a Static Data structure?
 In Static data structure the size of the structure is fixed. The content of the data structure can be modified but without changing the memory space allocated to it.



Example of Static Data Structures: Array 



What is Dynamic Data Structure? 
In Dynamic data structure the size of the structure is not fixed and can be modified during the operations performed on it. Dynamic data structures are designed to facilitate change of data structures in the run time.

Example of Dynamic Data Structures: Linked List 

Static Data Structure vs Dynamic Data Structure

Aspect Static Data Structure Dynamic Data Structure
Memory allocation Memory is allocated at compile-time Memory is allocated at run-time
Size Size is fixed and cannot be modified Size can be modified during runtime
Memory utilization Memory utilization may be inefficient Memory utilization is efficient as memory can be reused
Access Access time is faster as it is fixed Access time may be slower due to indexing and pointer usage
Examples Arrays, Stacks, Queues, Trees (with fixed size)  Lists, Trees (with variable size), Hash tables

Advantage of Static data structure :

Advantage Of Dynamic Data Structure :

Article Tags :