DS&A unit 2 (half)
DS&A unit 2 (half)
PAGE:
LINKED LIST DATE :
I;okd Ist sa
is dynamic data stuctune which
Can and stiok au Yequired duin g yen type
allocatio n the atlocath'on
wuing dynamie mamory
fictio'
NULL
pointen indicata the end of laked list.
of lioked Iist
sinqle Iinked list
double oked list
3 iTculan Ined list
dolble circulan lnked list
iot wickets ;
int 00 Ball
void main ()
Struck cricket
ineed list
# incluce
# inclde < malloc h
vofd CYeate - sLL ();
void diplay - sLL 03
void seanch - SLL) ;
void int- first
first-- SLL ();
void inent- lat. sLL ();
void i e t
-pos
void cdelete - fst-sue 0;
void dlelete lat- SLL);
void dlete - pos- SLL ();
stuct node
int data3
stuet node * net;
int choice ;
while (1)
else
H4
temp
stt =
3
piot t ("lo singly nkd list Guatedl In'):
stayt
Vofd
dplay- see()
Stuct node * temp;
iot Count = 0;
NULL)
printf ("
lse
lihkd Iist is empty "J;
iprint f (" ln contents of singly Iinkd tist are lo2
for (temp Sant tmp ! e noel; temp =temp ->next
Count tt
mp -’ data);
print f ("ln total nodu fn Itnked list
is %d", count};,
666
PAGE
DATE
void seanch - s LL )
tp stant;
while (temp
break;
temp tmP
clse
ntemp
stant =ntemp i
printf ("ln new node inted at frst
positienln");
Cun = stant
while ( cun - neat != NULL)
- ntemp
printF (ln nw node inyted at lat posihon
3
) neat sant:'
stant nkmp:
Yetunn
Count 1,
PAGE:
DATE
CUY = stant
wbile ( cwn ! = NULL B Count !=
pos)
tprev
Count +t}
if (ount = pos)
int n, factoyial;
printf (" Entn a nunben:|o);
Scant ( d"
factorial = fact (n)
printf ( he foctorial of td s td Io'.n,
foctorial);
PAGE:
DATE