Docsity

Doubly Linked List Implementation in C - Prof. Avasthi, Lecture notes of Data Structures and Algorithms

Partial preview of the text

Download Doubly Linked List Implementation in C - Prof. Avasthi and more Lecture notes Data Structures and Algorithms in PDF only on Docsity!

ASHISH AVASTHI

Data Structure

A data structure is a particular way of organizing data in a computer so that it can be used effectively.

What is Data Structure

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.

Algorithm Efficiency

There are two main complexity measures of the efficiency of an algorithm: Time complexity Space complexity

Algorithm Efficiency

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.

Space complexity

C h a r a c t e r i s t i c s , a d v a n t a g e s , a n d

disadvantages of algorithms

C h a r a c t e r i s t i c s , a d v a n t a g e s , a n d

disadvantages of pseudocodes

§ Arrays § Linked Lists § Trees § Stack § Queue § Graph

Basic Data Structures

§ 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

Arrays

Arrays

Array

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.

Array

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.

Single Dimension Array

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];

Single Dimension Array

/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(); }