In simple terms, "Data Structures stores data"
Where it is used?
It is used in computer science programming. In order to handle (store, manipulate,remove) the data involved in the programming problem effectively, we use data structures.
Some sample Data Structures: List,Stack,Queue,Tree,Graphs and many more.
Is data Structures important?
The common mantra in programming is "Algorithm+Data Structures = Program", So without data structures programming is just not possible.
More on Data Structures:
One aspect of data structures is that each data structure(ds) behaves very differently. I mean to say, that each ds (data structure) has its own way of storing, searching, manipulating,deleting the data. So one particular ds maybe suitable for particular program but another ds may not. So the right choice of ds for the programs you develop is an essential factor
Small Example to Illustrate Importance of Data Structures:
A simple program to print an integer in words.
#include <stdio.h>
#include <stdlib.h>
int main ( )
{
char zero [ 5 ] = "zero" ;
char one [ 5 ] = "one" ;
char two [ 5 ] = "two" ;
char three [ 10 ] = "three" ;
char four [ 5 ] = "four" ;
char five [ 5 ] = "five" ;
char six [ 5 ] = "six" ;
char seven [ 10 ] = "seven" ;
char eight [ 5 ] = "eight" ;
char nine [ 5 ] = "nine" ;
int number ;
clrscr ( ) ;
printf ( "Enter a number between 0 and 9...." ) ;
scanf ( "%d" , &number ) ;
switch ( number )
{
case 0 :
printf ( "%s" , zero) ;
break ;
case 1 :
printf ( "%s" , one ) ;
break ;
case 2 :
printf ( "%s" , two ) ;
break ;
case 3 :
printf ( "%s" , three ) ;
break ;
case 4 :
printf ( "%s" , four ) ;
break ;
case 5 :
printf ( "%s" , five ) ;
break ;
case 6 :
printf ( "%s" , six ) ;
break ;
case 7 :
printf ( "%s" , seven ) ;
break ;
case 8 :
printf ( "%s" , eight ) ;
break ;
case 9 :
printf ( "%s" , nine ) ;
break ;
}
getch ( ) ;
return 0 ;
}
The above simple program used one dimensional character array as the data structures. Now lets see another program which does the same thing but uses a two dimensional character array.
#include <stdio.h>
#include <stdlib.h>
int main ( )
{
char nos [ 20 ] [ 10 ] = { "Zero" ,
"One" ,
"Two" ,
"Three" ,
"Four" ,
"Five" ,
"Six" ,
"Seven" ,
"Eight" ,
"Nine" ,
"Ten" ,
"Eleven" ,
"Twelve" ,
"Thirteen" ,
"Fourteen" ,
"Fifteen" ,
"Sixteen" ,
"Seventeen" ,
"Eighteen" ,
"Nineteen"
} ;
int number ;
clrscr ( ) ;
printf ( "Enter a number between 0 and 19......." ) ;
scanf ( "%d" , &number ) ;
printf ( "%s\n" , nos [ number ] ) ;
getch ( ) ;
return 0 ;
}
Now do you see, how simple the program has become by a different choice of data structure.