Data Structure and Types
Overview of data structures and their types.
Data Structure refers to a specific way of organizing, managing, and storing data so that it can be accessed and modified efficiently. The type of data structure used directly impacts the performance of an algorithm. Data structures are broadly classified into two categories:
1. Primitive Data Structures
These are the basic structures available in most programming languages, representing simple values. They include:
- Integers: Whole numbers.
- Floats: Numbers with decimal points.
- Characters: Individual symbols, letters, or digits.
- Booleans: True or False values.
2. Non-Primitive Data Structures
Non-primitive data structures are more complex and can be built using primitive data types. They can be further classified into two types:
- Linear data structure
- Non-linear data structure
Linear Data Structures
In linear data structures, elements are arranged sequentially, and each element is connected to its previous and next element. The memory locations are contiguous in most cases.
Popular linear data structures: Array, Linked List, Stack, Queue and Hash Table.
Non linear data structures
In non-linear data structures, elements are not arranged sequentially. Each element is connected to multiple elements, forming a hierarchical structure.
Popular non-linear data structures: Trees and Graphs.