0% found this document useful (0 votes)
45 views25 pages

Assignment-19 (Singly Linked List)

The document outlines the structure and operations of a linked list data structure, detailing the creation, display, addition, and deletion of student nodes. It includes pseudocode for various functions related to managing a linked list of students, such as adding, deleting, and displaying student information. The document serves as an educational resource for understanding linked lists in programming.

Uploaded by

marnesum2503
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views25 pages

Assignment-19 (Singly Linked List)

The document outlines the structure and operations of a linked list data structure, detailing the creation, display, addition, and deletion of student nodes. It includes pseudocode for various functions related to managing a linked list of students, such as adding, deleting, and displaying student information. The document serves as an educational resource for understanding linked lists in programming.

Uploaded by

marnesum2503
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

DATE

Data 6ttue wsecl:

Linked Listi
A n ed st Cn releoe d Colleetvon of datd
which lement mnmum
two vlues, deta and l onk C5) to ts
paneclee esso)

ype of£ tenhed Los t


5enqby Linked List C5LL)

UnheL whwh evey no de has


Lust
wnk fild, to P ovide Únfo matvon alout whese
callel as
the
wnked
nent nnode of
wst.
4:ngly
head o200D0000
|00 200 300 400

FOR EDUCATIONAL USE


Pseudocode fo class 6tudent

ctuts declase Class 5 tu ent


2
Declae tht

stsng
6tuclent
name
tnet
Coeete funt t'on 5tuolent *
vod dis play CG tudent *head)
Gtucent*
Ueq-0ddcstudent * hoad )
Gtuclent * endacd Catudent k head)
5tudlent btwn addl stucont * head)
Gtudet beq _del C6tucent *head )
Gtuole nt* endl_del C Gbucent thead)
3tudent t btwndel CGtident t hiad)
Stucentt total Gtudent + head)
6tuclent ConCstudent heed atclent
headI )

P5eudo cocce fo 5tuclent * coeate c )

Declae ¿nt n
Gtudent * heud,*p
2 | I n t a l i 2e hea =NWLL
pes play 66 Ente nmbe
4 Recad n

fos clo

ig in
f head N uLL then
declae heal- new GtLdet
dl'splay 6fnteapn of pesident: s
FOR EDUCATIONAL USE
DATE

head head seol


G& Ente nae 0+ pJestde,
diplay
eod headhame
initiaLize headneet NLL
initvali2e p=hecal
else
int'tiai'e P’net hey Gtudent

initiale p= p-next
atiplc 96Entou pln ot membe ' 29

OLe'5play Fn te name 0f memla:9


pnare
Cn'tvlize pnet =NULL
end

6tuAn hecol

||P5eudo co de fo
vocd desplay Cstudent *head )
CueLte

2 foc Cp head; p-’next| 2NuLLppne et ) do


de begin
15 p name
end
pname
etusn

Pseueloc ode to Gtudent* beq- dld Cstudent theao)

Caete 6tuelent *
2 Initiali2e þ= hew 5tudet
FOR EDUCATIONAL USE
DATE

3
Desplay pn nc
pses. dent

6
Dos play G6 Ente a name of huw
pname
p-net NuLL
Tntiali ze pnen t hoad
6toeheud P
setun hecec

PGeudoc ode fo 4tudentt end-add Cstudent * hcud)


Csne ate
2. Initiaize
5tuelent *p, *q
P new 4tudent
pisplay
hel

Des plauy G Ente


6
Phame
5eceetasy:
6toe p net = NuLL
fo
|Ve qin
Cq-headnet NL q =g>nert) clo
end

sEtuen heccl

PGeLdoco de 5tudentt btun aeld Csttuent hell

Ipelase Cnt
2 Cweate
inctialize p= h e w 5tluelent
4 Dsplay Enten puun o ner meme!

FOR EDUCATIONAL USE


DATE

oo Cq - head q net - nent


NMLL1-9nont) do
end Gtoze pq net
5 toe
pEq-nent
delete
Q’nente NuLL
e tun

PGedot o de fo 4tuclentt btwn del Cstudert *head

pelae nt
2Cse ate 5tuedent
*P*4
3 Desplay 66 fnter psn of me mea which
cleleted:

heacl == NWLL then


66Lon ke List 0s empty
wetn headl
p=hed
7-whle Cp-nent ! NULL) lo

|beqin then
Gtose
pnet p-’nent ’net
delete

Gtoe pep net


end

FOR EDUCATIONAL USE


DATE

total Cs tlent
Pseueoe ode fo.A 6tuotent* houoy

2
Ceecte
Inetali ze total o
3
fose Pheod p! ULL:p p n e t do
beqen
en total

4DCsAetn
5
pLouy 66 To tel
nume of 9tuelents ase. 99 to tal

Pseuo Code fose 5tuent * Con C5tude nt +headd.


5tuulent *head 1)

2.
Cseote gtueent * P
fo
beqon p=heal,p’nent NuLL; Pp’neet do

etu en hee

Pseuelo Code fo tnt


mune)
| IntUali ze
2
Deelae che so, chasl,chad
3- Cseate
5tudent heacd, heacLi
4. Caete 4tuclent
5whle co lag) do
beqon
FOR EDUCATIONAL USE
9
?peeton Memeg
PeseLent:puesolent
pes cltec)
oly.Ct
pn,name memles
LI4T2
LINKED
2 opoketi'ons
on
awy us
menbe
seeet
to eos.
memnew new
LINKED
3CONCATENATE
Entet ve RemO
Ve
6 Pemove
Remo Totcl tunet0n
Cl
yoR
CHoIES
PRE: whte ddl Aded
dA
4.
LINKED
LI
G7|:
2)
choe: you |.
A
2. 3. 6. )Cchuy
4wetch
do G6
laq) 6playwalcposplay
cf Des Desplay
Ente 0)
06 whilebe4in
0chee
cehas
66
DcspLay Desplaywitch
Denplay
5
Lase2: beg-allcheo

udel lhecul':
Call fntion heeel or| rd
theud)
oky display
4'. Chel
btunadd
call feunction headd obj.
0uj desplas Che al)
teca k

Despley6 pemeved pueso denti


call functi on he ol : otj. bey-del Chea)

6'.

Dosplay Gc Removed secneyi


e l tuntien heat obt.end-doj Chea
otj.dsplay Chead)
Case 7:
Cul funet oon head oj. ttun- dellheucl )
Dusply 64 emle emovel
CUll funet on Chel)

Ca l function o b.tot al Cheud)


leak
FOR EDUCATIONAL USE
Cuse 2

5witch
Cchee) whle
Cse 2
Case |: display dspla4 end
cul dsplaywhat (luy
bueak cl
uneton funt'on Eet 4.3 To
4. Reno ve
5. 4. 3. )
(.Entea2. would default:
do
RemoeRemeve Ade Ada )clel (09e 9:
mendegtcl
byj. hedl
rewGeeet hew 4
ou 6elntea
dplay
display
Chendl)
o/-heall= pnneme fluyl: 0
IONAL
ay FORUSE
bihe
menes puesdent p
oy. = meme aresclent
wy a
el! Ug- u.ceet o to choitelI|2*
on
pesent ag peatoum
of ?
) deldl wst 2
me vold
Cheadl e
mie
g."
celse 3,

cull funetOn
hecal= ob.enel- acldChea
ouj. cespluy cheaol)

Case 4

.AL unetoh headl


obj.otuneelLCheal)
ouj. dusplay
Checll)
CCLse 5

display 6cRemo Ved


cel funet 'on headl=
dUi.teq-delCheadl
olj. clus play Cheasll)
bseak
Case 6 :

e
G6Removed
cal Puntvon o . enel- del Cheadl)
Cy. dsplay Cheadi)
tueak

cal functon heudl= oi. cheadi)


wtwn_alel2
cdl funt von oj.c'spluy chedi)
neak

Cul fune tuon obi.tot al Choacll )


Usek

Gtouue fluy -o
cuk
defaut
(6 Ente vld choce||
d'sply
beek
FOR EDUCATIONAL USE
Cal funetion head: oi. con Cheud,heall)
oby. dsplay Chead)
beak

beak

do fuult ;
66Ente vawd Choice

bwcak
end

6top

FOR EDUCATIONAL USE


ytaOnt

Lusk udert

4 r d rar

54udent
Vrd d'tplau (4dert *hcod)
641lcrt trd. aded (at ud art thead)
liaclel ( 6iudert thcad )
Uq-delstudrt thead )
erd. del (3t uden! thead )
yt un. del (stucentt head)
44 uclert

Elowhat fo Gtudent (scate ()

tudent (cale C)

5tuddert head,t p
head: NULL

No
oad ENUlL

Yes

head: rtw 6u dert


LertlNo

ad

, Flowchast fos
Vocd dos pley CGt uclent 4head)
Gt uclert (atudent heud

Gtuclent p

Pme
hast Gtudent Ueq-add CGtudent +head

xhead)
ktudent +ycq.odd (siudent

|prw studert

Lead
dent:*1
name ct new pus
splay i6frtea
od p-name/

Pnext NULL
p r e t hcod
head

uotun head)
student * headd)
end acld C
’Flowchast fose Gt ledent * %heocd )
Crdadd Cstudent
5udent * Ptq

/psplay

p-rezt NULL

head; q-snent! NUL; 4-9-ront


fo ca
qrent pl
nsct tou gtudent* sto beq-del ( Gtudent +head )

heud hodut

flowcho.ct foA end. del cstucdent 4hoad)


Adertt (rd.de dnt head

-flouwchaut fos twn-del Cstuclent *head)


tun del (5iudent *tead)||

66 Ero p

No
hoad NUL

uttun head

p:healk
lowchant
flowchast
terchatt

lfoa 6tucent *
fo
udtnt*

Cp:heo lp-htadip!:NULL
:p=pren) fo udenstt
(ctu con 66Totl
|pnet:
head| d,Stucent*pConCGtudent Xetu4n
heud) pret
ulLipp-net) C6tudert (dctuan
udent+p
C6tudry
5t 4otu PPrt dclcte
n Nut
(Gtudent
+head)
total p-neat-et
head *
head,*head.
) of No
6tu
student 6tdents *tcod)
dent

head! aue:
h
eadl)
|5a

iht cho4 0,chas l.cho 42


5 udent *hcod, *head|

Display
Display . LI NK ED LI6TI: \n2. LT NLED L16T
\n3. CoN CATENATE LINED LJ6T1 2 \n 4. fxIT'
prsplay \nfnicse choe:

od ehomg

case
No

/Display 46 whot
Ent ea pn, nam of membts
Drsplay 61. mtmles.5.
ntu FemovC
3. Pdd 5 e c e l . 4. Aoto
PemovC memle5/
peesr erti 6. Remove s0coto sq* 1.
It
8.1otal merbees pesert: 9.

ad choay

head= oUj.f.a ealec


cbj. rheSplay (hend)
case7
(head) olisplay |Dj
Chead) det end. oj.
/oplay
Lase6
Chtad) dspay |obj.
(hcad del beq- obj. head
Cheod)bj-dsplay
chead d en-
0d ou. head
(head) dispau 0uj.
d(heod &nd-ad ouj. reod
icod) d'play |ouj:
cud add
Ch Ura oj tad r
Lose2]
|loby.totatrod||

Dplcy what opeal ons


to peafom? dent
pn,nare of mrUek; 2 Ade neLw puth
D. splay 661. 1nle. hotseto.4 4.A dd new membesi 5.Remove
9. ndd
peeg dent: 6.peroove prsert: 4.t :

<chan2:

|heudl= ouj.curatet)
Chead)

-odd Cheodt)||
headl=
oj. obj-ue3
d5play thodi)
bra atddCicat
heod oj

heodouj. erd-oddehen d

eak

ase 4

head obj. btwn- 0dd chead


Obj"display Chead)

lcase 5

head obj. ieq- del (hcad


obj. dsplay Chtad)

ase 6

oj end. del Chead)


obj display Chead'

Lcase 7

head: olj.biun. del (head T

<k
|oby.total rtheod|]

delault

/Dsplay ifnte va ud therte y

(6what opoat ons


to pefun2
peta dert
,nare of wewfk: 2 fAdal ne
D. splay 6|. Ines pn
poy dcnt: 6.ernove iecsreta y: 7. Remove

od cta/
<chas:

ase]
hrudl= obj.tat e!)|
OUj.dist LCtu Che adl)

headl cbj-lcq-odl(heodI)
dsplay thend!)
Cheod)
ouj.diaploy

(ase 4|
heudl cbj.iun. ddd(heod|
oy-d sp'eg (herd!)

headl= oj. beq- dol (headtT


ouj. display (hcadl)

oy. end-del(h eod! )


olj. dlsplay Cheadi)

hcod ouj. btun. delchead!)

obj. total heod


defalt
G6Entet

head: buj. conChead, had


j.displau Chead)

defau!
vaid chote !!!
DATE

whet 5 Lin ked st State


n
an types.
which tollbction
m'no mum two
and Lonkts) t o
( and fo)

Lenked
L'nked Lest tn
noce hos che
nk field to poede On foumat'Gn
nocde
L'nked

200 300 400

2 Dou bhy inked LoGt

In douy nked i'st each node has t wo l'nk felds


'nfoumato abot who the net
abot ohoad of the node

each node

cand also

Ho42ooioos|B0ok206
200

L'nked L'st
The L'nk foeld of Lost node Got to
to mak end of
This unk feeled of node
4et to poch
fisst hode athe. than 5uch a nke
(elle d
L'hked 4t tinked

FOR EDUCATIONAL USE


kedu2oo|3oo5oo
C'ela douuy U'nk ecl ost, has
Like the
cloully
(alled
pornte the peeucoug poihteo,
to the Lnkod
Layt node Pocnt5 at the heael node,

Bod2000onsco2os 200 30 O

Werite appl'cat ons


Ang. - 1 mp le pmeniinq stacks and queuesi
angy wsed to daplenent
nd queues
Iin a Gtack elements a eee deled anee pmoved
end 4he Lost, uhele
fuom Ohe
eliments CLelcecl. at ane

fo m the othe end of the )


Navgat'on twe
wGts to sto sue thc
Girgly nked

t ables,
I mplementing aymbol 6-tuetues Uaed bo
data
Symbol taules Qee
Gongly lonkeod wsts ( an to uhple pment
wvth node
Valiee pa
FOR EDUCATIONAL. USE

You might also like