**What is Data Structure? **

Whenever we want to work with large amount of data, then organizing that large amount data is very important. If that data is not organized effectively, it is very difficult to perform any task on that data. If that data is organized effectively then any operation can be performed easily on that data. A data structure can be defined as follows:

**“Data structure is a method of organizing large amount of data more efficiently so that any operation on that data becomes easy”.** Based on the organizing method of a data structure, data structures are divided into two types.

- Primitive Data Structures
- Non-Primitive Data Structures

**1. Primitive Data Structures**

- Primitive data structures are the data structures available in most of the programming languages.
- These data structures are used to represent single value.
- Primitive Data Structures are the basic data structures that directly operate upon the machine instructions.
- Integers, floating point numbers, character constants, string constants, Boolean constants and pointers come under this category.

**Data Types **

In java every variable and every expression should has some type. Each and every type is clearly defined. Every assignment should be checked by compiler for type compatibility. Because of above reason we can conclude Java language is Strongly typed programming language.

Java is not considered as pure object-oriented programming language. Because several OOP principles are not satisfied by Java (like operator overloading, Multiple inheritance etc.). Moreover, we depending on primitive data types which are not objects.

Based on the data type of a variable, the operating system allocates memory and decides what can be stored in the reserved memory. There are two data types available in Java:

- Primitive Data Types
- Reference/Object Data Types

**2. Non-Primitive Data Structures**

- Non-primitive data structures are more complicated data structures and are derived from primitive data structures.
- Non-Primitive data types are used to store group of values.
- Array, Stack, Queue, Lists, Graphs etc. Comes under this category.
- Non-Primitive Data Structures again divided into 2 types
- Linear Data Structures
- Non – Linear Data Structures

**1. Linear Data Structures **

If a data structure is organizing the data in sequential or linear order, then that data structure is called as Linear Data Structure. Data elements in a liner data structure are traversed one after the other and only one element can be directly reached while traversing. Examples of linear data structures are Array, Stack, Linked List and Queue.

**Operations on linear Data Structures**

**Traversal:**Visit every part of the data structure**Search:**Traversal through the data structure for a given element**Insertion:**Adding new elements to the data structure**Deletion:**Removing an element from the data structure.**Sorting:**Rearranging the elements in some type of order (e.g Increasing or Decreasing)**Merging:**Combining two similar data structures into one.

**2. Non – Linear Data Structures**

The data structure where data items are not organized sequentially is called Non-Linear data structure. In other words, if a data structure is organizing the data in random order, then that data structure is called as Non-Linear Data Structure. Examples of Non-Linear data structures are Tree, Graph, Dictionaries, Heaps etc.