




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





























































































ASHISH AVASTHI
A data structure is a particular way of organizing data in a computer so that it can be used effectively.
T h e c o m p l e x i t y o f a n a l g o r i t h m i s a f u n c t i o n describing the efficiency of the algorithm in terms of the amount of data the algorithm must process. Usually there are natural units for the domain and range of this function.
There are two main complexity measures of the efficiency of an algorithm: Time complexity Space complexity
Space complexity is a function describing the amount of memory (space) an algorithm takes in terms of the amount of input to the algorithm. We often speak of "extra" memory needed, not counting the memory needed to store the input itself.
§ Arrays § Linked Lists § Trees § Stack § Queue § Graph
§ The arrays are also known as subscripted variables. § The array is the collection of Homogeneous type of data stored in the continuous memory space. § The arrays are of basic two types § Single Dimension § Multiple Dimension
The Array is the collection of Homogenous type of Data. It is also called subscripted variable. The Array is called subscripted data because the different values are determined by their index or indices.
The Array is different from defining the multiple variable because the multiple variable get defined where ever the space is available whereas the Array require continuous memory for its declaration. So this will help in accessing the variable fast.
When the arrangement of array is done in a single row with multiple column then it is called single dimension array. Ex. int a[5]; char s[10]; float f[5];
/Program for accepting five number and then print them in the reverse order/ #include <stdio.h> #include <conio.h> main() { int a[5],x; for(x=0;x<5;x=x+1) { printf("\n Enter the number"); scanf("%d", &a[x]); } for(x=4;x>=0;x=x-1) { printf("\n %d",a[x]); } getch(); }