Data structure is a way of storing and organising 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 in 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
Static Data structure has fixed memory size whereas in Dynamic Data Structure, the size can be randomly updated during run time which may be considered efficient with respect to memory complexity of the code. Static Data Structure provides more easier access to elements with respect to dynamic data structure. Unlike static data structures, dynamic data structures are flexible.
Use of Dynamic Data Structure in Competitive Programming
In competitive programming the constraints on memory limit is not much high and we cannot exceed the memory limit. Given higher value of the constraints we cannot allocate a static data structure of that size so Dynamic Data Structures can be useful.
Also, please refer Linked List vs Array for more information.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Static and Dynamic data structures in Java with Examples
- Implementation of Dynamic Array in Python
- Sorting a dynamic 2-dimensional array of Strings
- How do Dynamic arrays work?
- Longest subsequence with a given OR value : Dynamic Programming Approach
- Dynamic Segment Trees : Online Queries for Range Sum with Point Updates
- Optimal Strategy for the Divisor game using Dynamic Programming
- How to implement our own Dynamic Array class in Java?
- Program to find largest element in an array using Dynamic Memory Allocation
- A data structure for n elements and O(1) operations
- Applications of Graph Data Structure
- Remove duplicates from unsorted array using Map data structure
- Design a Queue data structure to get minimum or maximum in O(1) time
- Sort a 2D vector diagonally using Map Data Structure
- Inversion Count using Policy Based Data Structure
- Remove duplicates from unsorted array using Set data structure
- Stack Data Structure (Introduction and Program)
- Array of Structures vs. Array within a Structure in C/C++
- Structure Sorting (By Multiple Rules) in C++
- Introduction to Data Structures | 10 most commonly used Data Structures
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.