0% found this document useful (0 votes)
7 views11 pages

Stack Operations and Recursion Guide

Uploaded by

jhankit2058
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)
7 views11 pages

Stack Operations and Recursion Guide

Uploaded by

jhankit2058
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

tost Jist

Rn
a
Jit must PuSH
A
Puh Push
theoJAJ
stack
deleta to into element
stack Pehuah a)
nset to used tie s
teoheuatieys
ete
ele Ataek ztack
hto iesa wee
stu stak
one at ry
lolid 0Y
elenents
uslue) lota (ineas
STACK
thDELTA
ly
Daef
DELTAPo No

ue hae Hie condion


delet ed i not Whe
undefdan.
PUSH Pop

STACK, Tof, mA5T K, 1TéM)


USH (
Toh= MA XSTK then
psunt Caetloo Retu
ite

PoP (sTACK TOP, TÊM)


Psont
UndsallookRelisn
11eM Stack Top]
Cet
Roi
a
tack dhto Add
Ropeateaato i
edene boeAame as'
tote anbeiato Peach
Kepeatedly d)
ack add
to stauk Jeon bop
counezed push
t
Stack. onto
baseatteis
ls
ountesied
addi s
stak te tuntil
nd the to ) add stak anto CPush
P notaiin,
us ni Lwsuten
P)(6
PoLISH
tab
abt
Qtb
NUTAT1U/ YoLISH
Date/
DELTA \F NO

opiuoatb n e top Stack utl


tal
the lolt aantuses (do net
4) Remdue' at asantcsis to PJ
add the
Sit

Bcannod stak
C
A C
A
A
AB
AB

ABC
AfC*
ABcD
ABCD
ABC*D

Ct-ci ABC*0£F
ABC* De^/
JABC*DEE^/
Ctl-*
ABC*OECT/G*
DELIA

A A
A
AB

AB
AB
AB
Aß-D

AB-DE
AB-DE+

AB-DE +P
A-Detf
AB DP+f*/

A
A
(t
AB
LABt
ABt
ABt
ABtD
ABtD
AR+0E
ARtoe
Aßtoet|

Asigsent
Jaans hta by inapecte hand +

hito

a) (CAt6)/D) ‘ (E-F)*6)
)
(A+BtD)/E-p)+G
d) CCA+B)%p) 1(E- P)

2
Exaluatin
Jhis algo in ds the VALUE
VAWe
Qscitlaneli

element P
the senitel
3. sþeuad
STACK
encontred then
a) Remeve the to to elemeuts f STACE
the nent to toþ elennet
Evalat BA
) Plac the esult C6) back o
STACK
5 Aet yawE equal to te toh elemiat n
STACK

STACK
5
56
5,6, 2
5,8
vo, 12
o, 2, 4
/
37
RECURSION
STACK
(AFblitatio
ei the a all
cbel r a call att li a seendaod
Atat. to fat hs Cocuse aath
May cak bak to the
allad' a securgie hoocad
Rocuene eoceduase
cussue must
Jhea bemesia,
be cotain alled
tia, uica eoadu does
base
no call lse!
musl co wwe lose to te tia

Factagial
5 = 5. 24
24= Y23
nothen
A.| 2
20

fACTORIAL(EACT,
N) oi thout
N=o then et, Reussc)
9. cek fat=
Rabeat fe k= |to N
5
let
Reti fat fot *K
Date/
DELTA \Pg No

FACTORIAL/FACT, N) (wit Retuin )


&. Call factaual Cfåct, N-)
fact
Rabis

Hhen eat
sutceodaiy látac
nent h s t eus
dr n= than t =n
n 20

ClloN CC CEl, N)
NO

cal As0NA KCLFILA, N2)


3. frßoNt tc FeB, N

Rola
Dato
DELTA Pg No

LOAP -to mleeat STACK

uoid dlay

tnt
clhar cot;

sunt C'Ents
ch
ase

buuak

hseak
tase 2:
dukloy)
Date
DELTA\Pa No

top toþ +l;


Atack ltþ]=item;

Uod
Ctob== 0)

top = toþ -l:

else

in sd,stackli?).

You might also like