There are two types of data structure:
- Primitive data Structure
- Non-Primitive data Structure
Primitive data structure
- Primitive data structures are the fundamental data structures.
- It can be operated directly on the data and machine instructions.
- It is also know as basic data structure.
- Primitive data structures are defined by the programming languages, or we can say that it is built-in.
- Some of the Primitive data types are integer, real, character, floating point number, and pointer.
- Basically, ‘data-type’ , ‘data structure’ are often used interchangeably.
Non-primitive data structures
- Non-primitive data structures are the data structures that are created using the primitive data structures.
- It is little bit complicated as it is derived from primitive data structures.
- Some of Non-primitive data structures are linked lists, stacks, trees, and graphs.
- Also we can say that is a grouping of same or different data items.
Non-primitive data structures are classified into two categories
- Linear data structures
- Non-Linear data structures.
1. Linear data structures
- If the elements are stored in a linear or sequential order of a data structure, then it is known as a linear data structure.
- For Examples arrays, linked lists, stacks, and queues are the linear data structures.
- In memory, Linear data structures can be represented in two different ways.
- In the first way, the linear relationship between the elements is because of sequentially memory locations where items are stored. For example an array take memory in sequential fashion.
- And in the second way, elements have a linear relationship because of the link. For example node of the linked list are linked together because its node are arrange in memory in non-sequential fashion.
2). Non-linear data structures
- In Non-linear data structures, elements are not stored in sequential order.
- For Examples, trees and graphs are non-linear data structures.