# Primitive Data Structure

Primitive data structures are the fundamental data structures means Every programming language has built-in such Data Structure.

Primitive Data Structures are the basic data structures that directly operate upon the machine instructions.

in general, there are 8 data types

- boolean data type
- byte data type
- char data type
- short data type
- int data type
- long data type
- float data type
- double data type

Type of data structure that stores the data of only one type.

**Examples: integer, float, real , boolean, character, pointer.**

# Non-Primitive data Structure

Non-primitive data structures are user defined data structure that are created using the primitive data structures.

Type of data structure that can store the data of more than one type **ie.** grouping of same or different data items.

**Examples : Array, Linked List, Stack, Queue, Binary Tree, Binary Search Tree, Heap, Hashing, Graph, Matrix.**

# 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.

**Examples : Array, Linked List, Stack, Queue.**

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.

**Examples : Binary Tree, Binary Search Tree, Heap, Hashing, Graph, Matrix.**