0% found this document useful (0 votes)
12 views15 pages

ds assignment 2

Uploaded by

uniquetripathi07
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)
12 views15 pages

ds assignment 2

Uploaded by

uniquetripathi07
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/ 15

Date6ILL24

Page No. 1)

Auignmentk
into itt
Cauinlunt
tace At(6*C-D]E^EXG) H
PkH STACK, Tot, MAXTK LIEN)
ack. alAdy illed 2]
R rofToPtl Tnuasa Tof by 1

4.RohuM

STAKad àigns Hto th yaiable IICN.

4 Tof=0, Hun' inti UNDERELOW, Qnd Rehutn


2 et ITeM :=J TACK[To1 CALghs TofelemuT to ITEMJ
Date:
Page No. 12

Qutput Ackian
A bptiand ocddedlo
2 A

AB tlogmnd adddhoy
5 AB

+*ogardndoddedi ouba
ABC
ABC et farenttat"pudud
ABCO +(-C Oeerand added aouh
ABCA
LABCOE
(2

)
+-aperand added hau
AGCEA^/-*
16
OperandaÝcled to gup

BCEE^I* Oparahtpuealh
heerord adaledtauz
20
Date :
Page No. t 14

om deubly Ankeddist wning Cprogram

2 PoinGA to the mxt nocle lATrnu to tae ut Rode tn

3. ity to Hhe premous node, A eAtrne to te

Jaioud and backward Facii nocl is ceM LCHd to botle

Nhugak'onal RySteme uied ia apbliakona Ahere backard


and fuward maigakoa R Teguirecl uch as Neb
Lhzoaseashikox naugata)
5.
blocks.

incud (Stdiohs
ankodi
0ct Nado
int data
Shvct Nodu£ preu

aA delatNod1ltuct Nodet* Aaad restuctN


dlel_Nod

(k head_r2= NuLL IL duLNbd=NULL

dl nod’prev ’nt-delnode
Page No. 16
Lagtodl ey ENuL)
dlnoeprey utolelnod’nert

uuldinadal
(stucr Nacet node)
ttouct ode * (ast
rint£| TeaversQ! in talkardl dieokion n!):
ohilLlande I=NUL)
p8iatf%4nooa- darta );hbt
ast=nod
hode

iat main()f
thLct Nody Aad =NULL
Shruct Node* nodato Deleke k
dateleNodel Bheadu nodato Selen
paint Lit (headl
Date :

Page No. /1

BHexuntiai betut itnaten and ewion.

pablen.
uatien iRecunsien

thu Same
peat a bleck ef cadsubproblme o Condihon
i acONditien Met. hpt wntl a ba
2 Maintain lti
losg and astabla unetibin cas stacRa fach

Genalty

louex erhuad

Toiaud biy alaap Teminat d buy reacking.


á biot caseinthe recuri
funchid:
tlear toop truchise be brokendo'n ia to Sheal
Sabprobn (eq tru trowuskA
ICembainakoNal problen)
Date: I
Page No.(2

tho seurcL Yod to th destnaton Yod.

incueKCelio h
toeYÔHanoil nt n, chantoura char clestinaton.
ntd Char auriliore)

Hancailn,auxtliars, destinatn, Sourt


towerO{

int mainl)
int n
Stant(" %d", bn);

Last In fist put (LIfO) prinaple


Dete:I
Page No. \a
the last edemnt added to Hhe
That
4st one to be temOeo Stccke can be

asouad wah Stack are


teCh,
Parh Add an ikm to h top o thes
th
Pop Rmâe ahdrehn the'i ikm hrom
Hue sack.

#jacludt hdio h>


tt inclycu<stdib.h
incude<Skinquh
dsine MAX TOD
Sirvct Skack

int top
3

3
Date:
Page No. L0

uaid poshlshuct Stack *s, char jtlm) f

Tetusn!
-

S’iHem +4(s’ top)Jitm)

Chr pop(JrU tack *

Void everseShing (carf Lr)£


Shut stact s
iait Stack (es)
piat izaictltnct it)e
Date :
Page No. 21

4gets(st MAX,SHdlin
reverse Sringlor

Aolek te eeneat ron atinked tlpor all coseo

CASE 1:
TNSGIRSTONO, LINK,SIARL,AVAL, TEM)
[oVERCLDLw AYAIL =NOLL thunre 0VEREDWa
Jet NCW: AVAIL aud AVAILLtMeVAIL
Date :
Page No. 22

bnade.
st INc CNEw]:sTART (Newnode point to oriaind
it nodu]

new node

Ret NEw:EAVAL and AVAL!aLINK(AVAIL)


3.

St LIN KCNeW1:STAR aud gTART:= NEAJ

3et eiNK (NE1= LINK Lo1and LiNKLoENE


Date:
Page No. 3

0C:NulL, and Rhitn


3. Set SAVE'=3TARI d PTR LINK(STARTT.

1. Jet LoCSA VE
Date:I
Page No24
acedixg itEM1(Call
2.
I b Cal
INSAINEO,LINKTAK1, 1TEMLO)
NSLOC to inscit IEH

3. i t
INSLDC[Nfo, LLS START, AYAIL,TeM,LOGac

Delekion

AELLINEO, LINK TARI AYALLO LocR)


is alaoith mdet les the ode Nweith lpcation LOc.

Nis te irst noe LOCPE NULL}.

FlseA

CReturn deletedMode to te AVAL Lit


Qo LICLOcJ AVAL undiA VAL LOG
3-exit

iat Adc N
Date :
Page No. 25

p atig N. IIEMclpe wot agpcaY ia the it,t

Jet LoG '=NULL Md LDCP = NULL end Return

loCTRT and oCPNULL ahd ,


Set
Qtruchue
d
Set SAVETARI Qid
PTR= L NK [STA1

Set LDcz8TI nd LOCp 2 SVE and Retum

Topdas polutrs

8Rehurn.
Date :
Page No. 26

Aodu
Call fiNA 8(INFO, LINKTOEKT, ITEM, L6C,LOcPI

S. eleunod
It LoCP=NUL L then
Jet stART:2LINKSTART],(pleta tist hodeI
Set LINK(LoJ= LINKLoC]
Struchue J
4.Rurn alete nod do fte fAYAIL t
3et ti LINLoJ: AVAIL and AVML!=Loc.
5-||i t

You might also like