The term data structure is used to describe the way data is stored, and the term algorithm is used to describe the way data is processed. Data structures and algorithms are interrelated. Choosing a data structure affects the kind of algorithm you might use, and choosing an algorithm affects the data structures we use.
An Algorithm is a finite sequence of instructions, each of which has a clear meaning and can be performed with a finite amount of effort in a finite length of time. No matter what the input values may be, an algorithm terminates after executing a finite number of instructions.

Data Structure

Data structure is a representation of logical relationship existing between individual elements of
data. In other words, a data structure defines a way of organizing all data items that considers
not only the elements stored but also their relationship to each other. The term data structure
is used to describe the way data is stored.

To develop a program of an algorithm we should select an appropriate data structure for that
algorithm. Therefore, data structure is represented as:

Algorithm + Data structure = Program

A data structure is said to be linear if its elements form a sequence or a linear list. The linear
data structures like an array, stacks, queues and linked lists organize data in linear order. A
data structure is said to be non linear if its elements form a hierarchical classification where,
data items appear at various levels.
Trees and Graphs are widely used non-linear data structures. Tree and graph structures
represents hierarchical relationship between individual data elements. Graphs are nothing but
trees with certain restrictions removed.

Types Of Data Structures

Primitive data structures
Non-primitive data structures

Datastructures

Primitive Data Structures

Primitive Data Structures are the basic data structures that directly operate upon the
machine instructions. They have different representations on different computers. Integers,
floating point numbers, character constants, string constants and pointers come under this
category.

Non-primitive data structures

Non-primitive data structures are more complicated data structures and are derived from
primitive data structures. They emphasize on grouping same or different data items with
relationship between each data item. Arrays, lists and files come under this category.