You are on page 1of 29

Data Structures Lab Manual

for
II B.Tech. CSE and IT I Sem
JNTUWORLD
(JNTU, Kakinada)
www.jntuworld.com
www.jntuworld.com
Exercise 1
Questi on: Write recursive programme which computes the nth Fibonacci number,
for appropriate values of n. Analyze behavior of the programme. Obtain the frequency
count of the statement for various values of n.
#include<stdio.h>
int fibonacci(int n)
{
if(n==1)
return 0;
else if(n==2)
return 1;
else
return fibonacci(n-1)+fibonacci(n-2);
}
int ain()
{
int n!fib;
"rintf(#$n$n %%%%%%%%%%%%%%&ro'ra to find nth fibonacci nuber in the
series%%%%%%%%%%%%$n$n#);
"rintf(#(nter nuber of )alue in the series * #);
scanf(#+d#!,n);
fib=fibonacci(n);
"rintf(#$n$n$n$n$t$t +d th -alue in the series is +d$n$n$n#!n!fib);
}
output:
www.jntuworld.com
www.jntuworld.com
Exercise 2
Questi on: Write recursive programme which computes the factorial of a given
number.
#include<stdio.h>
int .actorial(int n)
{
if(n==0)
return 1;
else
return n%.actorial(n-1);
}
int ain()
{
int n!fact;
"rintf(#$n$n (nter the nuber in the se/uence * #);
scanf(#+d#!,n);
fact=.actorial(n);
"rintf(#$n$n$n .actorial )alue in the series is +d$n$n$n$n#!fact);
}
output:
www.jntuworld.com
www.jntuworld.com
EXERCISE 4
Question 1: Write c program to implement bubblesort, to sort a given list of integers in
ascending order.
#include<stdio.h>
)oid 0ubble1ort(int 23! int);
)oid &rint(int23!int!int);
)oid 0ubble1ort(int list23! int si4e)
{
int i!5!te";
for(i=0;i<si4e-1;i++)
{
for(5=0;5<si4e-1-i;5++)
{
if(list253>list25+13)
{
te"=list253;
list253=list25+13;
list25+13=te";
}
}
"rintf(#$n$n$t$t$t$t$t6ist after +d iteration * #!i);
&rint(list!si4e!si4e-i-1);
}
}
)oid &rint(int list23!int si4e!int ar7)
{
int i;
for(i=0;i<si4e;i++)
{
if(i==ar7)
"rintf(#2#);
"rintf(#+d #!list2i3);
}
"rintf(#3#);
}
int ain()
{
int list2203!si4e!i;
"rintf(#$n$n (nter the si4e of the list *#);
scanf(#+d#!,si4e);

8% 9ead the eleents fro the user %%8
"rintf(#$n$n (nter the eleents *$n$n$n#);
www.jntuworld.com
www.jntuworld.com
for(i=0;i<si4e;i++)
scanf(#+d#!,list2i3);
"rintf(#$n$n6ist before sortin'* #);
&rint(list!si4e!0);
8% 1ort the eleents usin' 0ubblesort %8
0ubble1ort(list!si4e);

8% "rint the eleents %8
"rintf(#$n$n 1orted list * #);
&rint(list!si4e!0);
"rintf(#$n$n$n#);
}
Output:
www.jntuworld.com
www.jntuworld.com
Questi on 2:
&ro'ra to i"leent insertion sort to sort a 'i)en list of inte'ers in ascendin' order.
8% :9;<( = &9>?9@A <> ;A&6(A(B< ;B1(9<;>B 1>9<! <> 1>9< @
?;-(B 6;1< >. ;B<(?(91 ;B @1=(BC;B? >9C(9%8
#include<stdio.h>
)oid ;nsertion1ort(int 23! int);
)oid &rint(int23!int!int);
)oid ;nsertion1ort(int list23! int si4e)
{
int i!5!te";
for(i=1;i<si4e;i++)
{
te"=list2i3;
for(5=i;5>0,,te"<list25-13;5--)
list253=list25-13;
list253=te";
"rintf(#$n$n$t$t$t 6ist after +d iteration * #!i);
&rint(list!si4e!i-1);
}
}
)oid &rint(int list23!int si4e!int ar7)
{
int i;
"rintf(#2#);
for(i=0;i<si4e;i++)
{
"rintf(# +d #!list2i3);
if(i==ar7)
"rintf(#3#);
}
}
int ain()
{
int list2203!si4e!i;
"rintf(#$n$n (nter the si4e of the list *#);
scanf(#+d#!,si4e);

8% 9ead the eleents fro the user %%8
"rintf(#$n$n (nter the eleents *$n$n$n#);
for(i=0;i<si4e;i++)
scanf(#+d#!,list2i3);
www.jntuworld.com
www.jntuworld.com
"rintf(#$n$n6ist before sortin'* #);
&rint(list!si4e!0);
8% 1ort the eleents usin' 0ubblesort %8
;nsertion1ort(list!si4e);

8% "rint the eleents %8
"rintf(#$n$n 1orted list * #);
&rint(list!si4e!si4e-1);
"rintf(#$n$n$n#);
}
output:
www.jntuworld.com
www.jntuworld.com
Questi on 2:
A program to implement INSERTION SORT to sort a list of numbers.
8% "ro'ra to i"leent 1election 1ort for sortin' eleents in ascendin' order%8
#include<stdio.h>
)oid 1election1ort(int 23! int);
)oid &rint(int23!int!int);
)oid 1election1ort(int list23! int si4e)
{
int i!5!te";
int lar'est;
8% .ind sallest eleent in the list and "ut in its a""ro"riate "osition %8
for(5=si4e-1;5>0;5--)
{
lar'est=5;
for(i=0;i<5;i++)
{
if(list2lar'est3 < list2i3)
lar'est=i;
}
88 "rintf(#$n$n 1allest eleent * +d#!list2bi'3);
te"=list253;
list253=list2lar'est3;
list2lar'est3=te";
}
}88 (nd of function
)oid &rint(int list23!int si4e!int ar7)
{
int i;
"rintf(#2#);
for(i=0;i<si4e;i++)
{
"rintf(# +d #!list2i3);
if(i==ar7)
"rintf(#3#);
}
}
int ain()
{
int list2203!si4e!i;
"rintf(#$n$n (nter the si4e of the list *#);
scanf(#+d#!,si4e);

8% 9ead the eleents fro the user %%8
"rintf(#$n$n (nter the eleents *$n$n$n#);
www.jntuworld.com
www.jntuworld.com
for(i=0;i<si4e;i++)
scanf(#+d#!,list2i3);
"rintf(#$n$n6ist before sortin'* #);
&rint(list!si4e!0);
8% 1ort the eleents usin' 0ubblesort %8
1election1ort(list!si4e);

8% "rint the eleents %8
"rintf(#$n$n 1orted list * #);
&rint(list!si4e!si4e-1);
"rintf(#$n$n$n#);
}
>utput:
www.jntuworld.com
www.jntuworld.com
EXERCISE 5
Question 3: Write a C program that implement mergesort, to sort a given list of
integers in ascending order.
Program:
8% &9>?9@A <> 1>9< @ 6;1< >. BDA0(91 D1;B? A(9?( 1>9< %8
#include<stdio.h>
)oid Aer'e(int list23!int te"orarE23!int left!int center!int ri'ht(nd);
)oid Aer'e1ort(int list23!int te"orarE23!int left! int ri'ht);
)oid &rint(int list23!int si4e!int ar7)
{
int i;
for(i=0;i<si4e;i++)
{
if(i==ar7)
"rintf(#2#);
"rintf(#+d #!list2i3);
}
"rintf(#3#);
}
)oid Aer'e1ort(int list23!int te"orarE23!int left! int ri'ht)
{
int center;
if(left<ri'ht)
{
center=(left+ri'ht)82;
Aer'e1ort(list!te"orarE!left!center);
Aer'e1ort(list!te"orarE!center+1!ri'ht);
Aer'e(list!te"orarE!left!center+1!ri'ht);
}
}
)oid Aer'e(int list23!int te"orarE23!int left!int center!int ri'ht(nd)
{
int left(nd=center-1;
int t""os=left;
int ri'ht=center;
int nu(leents=ri'ht(nd-left+1;
int i;
Fhile(left<=left(nd ,, ri'ht<=ri'ht(nd) 8% :hen both lists are not
eGhausted %8
{
if(list2left3<=list2ri'ht3)
{
te"orarE2t""os3=list2left3;
www.jntuworld.com
www.jntuworld.com
t""os++;
left++;
}
else
{
te"orarE2t""os3=list2ri'ht3;
t""os++;
ri'ht++;
}
}
8% Fhen ri'ht list is eGhausted %8
Fhile(left<=left(nd)
{
te"orarE2t""os3=list2left3;
t""os++;
left++;
}
8% :hen left list is eGhausted %8
Fhile(ri'ht<=ri'ht(nd)
{
te"orarE2t""os3=list2ri'ht3;
t""os++;
ri'ht++;
}
8% co"E the entire list into to ori'inal list %8
for(i=0;i<nu(leents;i++!ri'ht(nd--)
list2ri'ht(nd3=te"orarE2ri'ht(nd3;
}
int ain()
{
int list2203!si4e!i!te"orarE2203!center;
"rintf(#$n$n (nter the si4e of the list *#);
scanf(#+d#!,si4e);

8% 9ead the eleents fro the user %%8
"rintf(#$n$n (nter the eleents *$n$n$n#);
for(i=0;i<si4e;i++)
scanf(#+d#!,list2i3);
"rintf(#$n$n6ist before sortin'* #);
&rint(list!si4e!0);
8% 1ort the eleents usin' 0ubblesort %8
Aer'e1ort(list!te"orarE!0!si4e-1);

8% "rint the eleents %8
www.jntuworld.com
www.jntuworld.com
"rintf(#$n$n 1orted list * #);
&rint(list!si4e!0);
"rintf(#$n$n$n#);
}
>D<&D<*
www.jntuworld.com
www.jntuworld.com
EXERCISE 6
Question 1: :rite = "ro'ras that i"leent stac7 usin' arraEs
&ro'ra*
8% :rite = "ro'ra that i"leent stac7 usin' arraE %8
#include<stdio.h>
88#include<"rocess.h>
#define 1<@=H1;I( 20

8% 1<@=H C@<@1<9D=<D9( C(.;B;<;>B %8
tE"edef struct 1tac7
{
int eleents21<@=H1;I(3;
int to";
}1tac7;
8% 1<@=H >&(9@<;>B1 %8
)oid "ush(1tac7 %s! int eleent)
{
if(s->to"==1<@=H1;I() 8% >-(9.6>: =>BC;<;>B %8
"rintf(#$n$n 1<@=H >-(9.6>: #);
else
s->eleents2s->to"++3=eleent;
}
int "o"(1tac7 %s)
{
if(s->to"==0)
{
"rintf(#$n$n (A&<J 1<@=H #);
return -1;
}
else
{
--s->to";
return s->eleents2s->to"3;
}
}
int "ee7(1tac7 %s)
{
if(s->to"==0)
{
"rintf(#$n$n$n (A&<J 1<@=H #);
return -1;
www.jntuworld.com
www.jntuworld.com
}
return s->eleents2s->to"-13;
}
)oid "rint(1tac7 %s)
{
int i;
"rintf(#$n$n 2 #);
for(i=0;i<s->to";i++)
"rintf(# +d #!s->eleents2i3);
"rintf(# 3#);
}
int ain()
{
1tac7 s1;
int o"t!G;
s1.to"=0;
Fhile(1)
{
"rintf(#$n$n$n$t$t 1<@=H >&(9@<;>B1 $n$n$n#);
"rintf(#$n$n 1. &ush #);
"rintf(#$n$n 2. &o" #);
"rintf(#$n$n K. &rint (leents #);
"rintf(#$n$n L. &ee7 #);
"rintf(#$n$n M. (Git #);
"rintf(#$n$n 1elect the o"eration * #);scanf(#+d#!,o"t);
sFitch(o"t)
{
case 1* "rintf(#$n$n (nter the eleent to insert in stac7 *#);
scanf(#+d#!,G);
"ush(,s1!G);
brea7;
case 2* "rintf(#$n$n$n &o""ed eleent * +d#!"o"(,s1));
brea7;
case K* "rintf(#$n$n (leents in stac7 * #);
"rint(,s1);
brea7;
case L* "rintf(#$n$n <o" eleent in the stac7 * +d#!"ee7(,s1));
brea7;
case M* return;88eGit(N);
}
}
return 0;
}
www.jntuworld.com
www.jntuworld.com
&ro'ra 2* :rite = "ro'ras that i"leent stac7 usin' lin7ed list
&ro'ra*
8% 6;BH(C 6;1< ;A&6(A(B<@<;>B >. 1<@=H %8
#include<stdio.h>
88#include<alloc.h>
#include<stdlib.h>
8% (leent definition %8
tE"edef struct (leent
{
int data;
struct (leent %lin7;
}(leent;

8% 1tac7 Cefintion %8
tE"edef struct 1tac7
{
(leent %to";
}1tac7;
(leent% createBode(int data)
{
(leent %node;
node=alloc(si4eof((leent));
node->data=data;
node->lin7=BD66;
return node;
}
)oid "ush(1tac7 %s!int data)
{
(leent %node;
node=createBode(data);
node->lin7=BD66;
if(s->to"==BD66)
{
s->to"=node;
}
else
{
node->lin7=s->to";
s->to"=node;
}
}
www.jntuworld.com
www.jntuworld.com
)oid "o"(1tac7 %s)
{
(leent %te";
int G;
if(s->to"==BD66)
"rintf(#$n$n (A&<J 1<@=H #);
else
{
te"=s->to";
s->to"=s->to"->lin7;
te"->lin7=BD66;
G=te"->data;
"rintf(#$n$n Celeted (leent *+d#!G);
}
}
int "ee7(1tac7 %s)
{
return s->to"->data;
}
)oid "rint1tac7(1tac7 %s)
{
(leent %tra)erse=s->to";
"rintf(#$n$n 1<@=H * 2 #);
Fhile(tra)erseO=BD66)
{
"rintf(# +d #!tra)erse->data);
tra)erse=tra)erse->lin7;
}
"rintf(# 3 #);
}
)oid ain()
{
1tac7 s;
int o"t!G;
s.to"=BD66;
Fhile(1)
{
"rintf(#$n$n$n ============ 1<@=H >&(9@<;>B1
=============$n$n$n#);
"rintf(#$n$n 1. &ush #);
"rintf(#$n$n 2. &o"#);
"rintf(#$n$n K. &rint 1tac7 #);
"rintf(#$n$n L. &ee7 #);
"rintf(#$n$n M. (Git#);
"rintf(#$n$n 1elect the o"eration * #);scanf(#+d#!,o"t);
sFitch(o"t)
www.jntuworld.com
www.jntuworld.com
{
case 1*"rintf(#$n$n (nter eleent to insert #);
scanf(#+d#!,G);
"ush(,s!G);
brea7;
case 2*
"o"(,s);
brea7;
8% "o""in' %8
case K*
"rint1tac7(,s);
brea7;
case L*
"rintf(#$n$n (leent of to" of the stac7 * +d#!"ee7(,s));
brea7;
case M*return;
}8% end of sFitch %8
}8% end of Fhile loo" %8
}8% (BC >. <P( &9>?9@A %8
>D<&D<*
www.jntuworld.com
www.jntuworld.com
www.jntuworld.com
www.jntuworld.com
EXERCISE 7
Question 2:
Write c programs that implement Queue using array
Program
8% @rraE i"leentation of Queues %8
#include<stdio.h>
#define A@RQD(D( 20
tE"edef struct Queue
{
int eleents2A@RQD(D(3;
int front! rear;
}Queue;
)oid insert(Queue %/!int data) 8% ;B1(9<1 @B (6(A(B< ;B<>
QD(D( %8
{
if(/->rear==A@RQD(D()
"rintf(#$n$n Queue o)erfloF #);
else
{
/->eleents2/->rear3=data;
/->rear++;
}
}
int reo)e(leent(Queue %/)
{
int G=0;
if(/->front==/->rear)
"rintf(#$n$n ("tE Queue #);
else
{
G=/->eleents2/->front3;
/->front++;
}
return G;
}
)oid "rint(Queue /)
{
int i;
"rintf(#$n$n$n QD(D( * 2 #);
for(i=/.front;i</.rear;i++)
"rintf(# +d #!/.eleents2i3);
"rintf(# 3#);
}
int ain()
{
www.jntuworld.com
www.jntuworld.com
8% ;nitiali4e /ueue %8
Queue /;
int o"t!G;
/.front=0;
/.rear=0;
Fhile(1)
{
"rintf(#$n$n$n$t$t QD(D( >&(9@<;>B1 $n$n$n#);
"rintf(#$n$n 1. ;nsert eleent #);
"rintf(#$n$n 2. 9eo)e eleent #);
"rintf(#$n$n K. &rint (leents #);
"rintf(#$n$n L. (Git #);
"rintf(#$n$n 1elect the o"eration * #);scanf(#+d#!,o"t);
sFitch(o"t)
{
case 1* "rintf(#$n$n (nter the eleent to insert in Queue *#);
scanf(#+d#!,G);
insert(,/!G);
brea7;
case 2* "rintf(#$n$n$n Celeted eleent *
+d#!reo)e(leent(,/));
brea7;
case K* "rintf(#$n$n (leents in Queue* #);
"rint(/);
brea7;
case L* return;88eGit(N);
}
}

return 1;
}
Question 3:
Write C programs that implement Queue using linked lists.
Program:
8% :9;<( @ &9>?9@A <> ;A&6(A(B< QD(D( D1;B? 6;BH(C 6;1< %8
#include<stdio.h>
#include<stdlib.h>
8% (leent definition %8
tE"edef struct (leent
{
int data;
struct (leent %lin7;
}(leent;

8% Queue Cefintion %8
www.jntuworld.com
www.jntuworld.com
tE"edef struct Queue
{
(leent %front;
(leent %rear;
}Queue;
(leent% createBode(int data)
{
(leent %node;
node=alloc(si4eof((leent));
node->data=data;
node->lin7=BD66;
return node;
}
)oid insert(Queue %/!int G)
{
(leent %neFnode;
neFnode=createBode(G);
if(neFnode==BD66)
{
"rintf(#$n$n ;B1D..;=;(B< A(A>9J #);
return;
}
if(/->front==BD66 ,, /->rear==BD66)
8% ;B1(9< B>C( ;B (A&<J QD(D( %8
{
/->front=neFnode;
/->rear=neFnode;
}
else
8% ;B1(9< (6(A(B< ;B<> B>B (A&<J QD(D( %8
{
/->rear->lin7=neFnode;
/->rear=neFnode;
}
}
)oid reo)e(leent(Queue %/)
{
(leent %te";
if(/->front==BD66)
{
"rintf(#$n$n (A&<J QD(D( $n$n#);
return;
}
te"=/->front;
/->front=/->front->lin7;
www.jntuworld.com
www.jntuworld.com
te"->lin7=BD66;
"rintf(#$n$n Celeted (leent * +d #!te"->data);
free(te");
if(/->front==BD66) 8% :hen all the eleents are deleted %8
/->rear=BD66;
}88 (nd of reo)e(leent()
)oid "rint(Queue %/)
{
(leent %tra)erse;
tra)erse=/->front;
"rintf(#$n$n 2.9>B<3 2 #);
if(tra)erse==BD66)
"rintf(# (A&<J QD(D(#);
Fhile(tra)erseO=BD66)
{
"rintf(# +d #!tra)erse->data);
tra)erse=tra)erse->lin7;
}

"rintf(# 3 29(@9 3 $n$n$n#);
}
int ain()
{
Queue /;
int o"t!G;
/.front=BD66;
/.rear=BD66;
Fhile(1)
{
"rintf(#$n$n$n$t$t QD(D( >&(9@<;>B1 $n$n$n#);
"rintf(#$n$n 1. ;nsert eleent #);
"rintf(#$n$n 2. 9eo)e eleent #);
"rintf(#$n$n K. &rint (leents #);
"rintf(#$n$n L. (Git #);
"rintf(#$n$n 1elect the o"eration * #);scanf(#+d#!,o"t);
sFitch(o"t)
{
case 1* "rintf(#$n$n (nter the eleent to insert in Queue *#);
scanf(#+d#!,G);
insert(,/!G);
brea7;
case 2* reo)e(leent(,/);
brea7;
case K* "rintf(#$n$n (leents in Queue* #);
"rint(,/);
brea7;
www.jntuworld.com
www.jntuworld.com
case L* return;88eGit(N);
}
}

return 1;
}
>D<&D<*
www.jntuworld.com
www.jntuworld.com
www.jntuworld.com
www.jntuworld.com
(R(9=;1( S
:rite "ro'ra to i"leent lin7ed list o"erations( =reation! ;nsertion! Celetion! re)ersin' ).
&ro'ra
8% ;A&6(A(B<@<;>B >. 6;BH(C 6;1< %8
#include<stdio.h>
#include<stdlib.h>

tE"edef struct 6ist;te 8% node definition %8
{
int data;
struct 6ist;te %lin7;
}6ist;te;
tE"edef struct 6ist
{
6ist;te %root;
}6ist;
6ist;te% createBode(int data)
{
6ist;te %node;
node=alloc(si4eof(6ist;te));
node->data=data;
node->lin7=BD66;
return node;
}
)oid insert;te(6ist %l1!int ite)
{
6ist;te %te"!%tra)erse;
te"=createBode(ite);
if(te"==BD66)
{
"rintf(#$n$n AeorE error#);
return;
}
if(l1->root==BD66)
{
l1->root=te";
return;
}
else
{
tra)erse=l1->root;
Fhile(tra)erse->lin7O=BD66)
tra)erse=tra)erse->lin7;
tra)erse->lin7=te";
www.jntuworld.com
www.jntuworld.com
}
}
)oid insert@t(6ist %l1!int "os! int ite)
{
6ist;te %te"!%tra)erse;
int i=1;
te"=createBode(ite);
if(te"==BD66)
{
"rintf(#$n$n AeorE error#);
return;
}
if("os<1)
{
"rintf(#$n$n ;n)alid "osition #);
}
else if("os==1)
{
te"->lin7=l1->root;
l1->root=te";
}
else
{
tra)erse=l1->root;
Fhile(tra)erse->lin7O=BD66 ,, i<"os-1)
{
tra)erse=tra)erse->lin7;
i++;
}
if(iO="os-1)
{
"rintf(#$n$n ;n)alid "osition #);
return;
}
te"->lin7=tra)erse->lin7;
tra)erse->lin7=te";
}
}

)oid delete;te(6ist %l1)
{
6ist;te %te"!%tra)erse;
if(l1->root==BD66)
{
"rintf(#$n$n (A&<J 6;1< #);
return;
www.jntuworld.com
www.jntuworld.com
}
tra)erse=l1->root;
if(tra)erse->lin7==BD66)
{
te"=tra)erse;
"rintf(#$n$n Celeted ;te * +d #!te"->data);
l1->root=BD66;
free(te");
return;
}
Fhile(tra)erse->lin7->lin7O=BD66)
tra)erse=tra)erse->lin7;
te"=tra)erse->lin7;
tra)erse->lin7=BD66;
"rintf(#$n$n Celeted ;te * +d #!te"->data);
free(te");
}
)oid dis"laE(6ist %l1)
{
6ist;te %tra)erse;
tra)erse=l1->root;
"rintf(#$n$n 9>>< #);
Fhile(tra)erseO=BD66)
{
"rintf(# +d #!tra)erse->data);
tra)erse=tra)erse->lin7;
}
"rintf(# (BC #);
}
)oid re)erse&rint(6ist %l1)
{
6ist;te %tra)erse=BD66!%te"=BD66;
te"=l1->root;
Fhile(te"O=tra)erse)
{
Fhile(te"->lin7O=tra)erse)
te"=te"->lin7;
"rintf(# +d #!te"->data);
tra)erse=te";
te"=l1->root;
}
}
)oid re)erse6ist(6ist %l1)
{
6ist;te %tra)!%te"!%neFroot;
if(l1->root==BD66 TT l1->root->lin7==BD66)
www.jntuworld.com
www.jntuworld.com
{
return;
}
tra)=l1->root;
Fhile(tra)->lin7O=BD66) 8% .;BC <P( B(: 9>>< %8
tra)=tra)->lin7;
neFroot=tra);

Fhile(tra)O=l1->root)
{
te"=l1->root;
Fhile(te"->lin7O=tra))
{
te"=te"->lin7;
}
tra)->lin7=te";
tra)=te";
}
tra)->lin7=BD66;
l1->root=neFroot;

88"rintf(# $n$n$n +d #!neFroot->data);
}
)oid ain()
{
6ist l1;
int o"t;
int G;
int "os;
l1.root=BD66;
Fhile(1)
{
"rintf(#$n$n$t$t$t 6;BH(C 6;1< >&(9@<;>B1 $n$n#);
"rintf(#$n$n$t$t$t 1. @dd ;te #);
"rintf(#$n$n$t$t$t 2. Celete ;te #);
"rintf(#$n$n$t$t$t K. 9e)erse 6ist #);
"rintf(#$n$n$t$t$t L. 1hoF ;tes #);
"rintf(#$n$n$t$t$t M. 9e)erse &rint #);
"rintf(#$n$n$t$t$t U. ;nsert ;te #);
"rintf(#$n$n$t$t$t N. (Git #);
"rintf(#$n$n 1elect the o"eration *#);
scanf(#+d#!,o"t);
sFitch(o"t)
{
case 1*
"rintf(#$n$n (nter the eleent to insert into list *#);
www.jntuworld.com
www.jntuworld.com
scanf(#+d#!,G);
insert;te(,l1!G);
brea7;
case 2*
delete;te(,l1);
brea7;
case K*re)erse6ist(,l1);
brea7;
case L*dis"laE(,l1);
brea7;
case M*re)erse&rint(,l1);
brea7;
case U*"rintf(#$n$n (nter the eleent to insert into list *#);
scanf(#+d#!,G);
"rintf(#$n$n (nter the "osition *#);
scanf(#+d#!,"os);
insert@t(,l1!"os!G);
brea7;
case N*
return;
}
}
}
>D<&D<*
www.jntuworld.com
www.jntuworld.com

You might also like