Assignment 3
Assignment 3
2 3
Linked List
1Explain made atructure _of Sll,DLL. SCL,Dcl._
Node siruciure of dingly linked list:
node Ode
ode Ylode
Dala K
C Yev
Dat
has Gublists..
A generalized list G is inite Gequence ot nz20
a
NODE*neonode temp;
int is
*oye temp to node at pos
-1
¢4lii=pos-0: i+
torCtemp=head.i=li (Hempl=NUL
temp=temp>next:
iHCtemp==NULL2
of range")i
PaintfC "Pasilion_ i6 out
e un;-
Mewnode=CNODE*malloc CSizeofCNoDEM
newncdeinBo= Dum;_
temp->nexBZ
Insest neonade hetween temp §
newnode-> next = temp>nexti
tenp next newnndes
NoDEtemp, *empli
int is
*love temp tu node at pas - 7
o r Ctemp=head, i=ls (temp-ncxtl=NULLY & S
Cis=poS-D: i+t
temp=iemp-nexti
ifCtemp- 2next == NULL
temp1= Lemp2nexts
tempnext= templ nexti
ree Ctempl);
Data
NODE temp;
forCtemp=headnext; termpl=NVLi temp=temp-2nex)d
ifCtempintoz2==0)
pinttC"Zd\t"> temp->into)i
NODE *temp;
int pos, Sum=0
for(temp=head,pos=Os temp=NDL; temp=kemp->nexl,
pastt)
iflpoS2 ==0)
Sum=tempdata +Sum;