Download as pdf or txt
Download as pdf or txt
You are on page 1of 25

I.

white a Poysom n c o }nset m elem ent aB a


iven o coken n am o
nu
#indda <skioh
moin C)
alhoy LIoo1, POsutiotn, C, h valne.)
ptainb ("Efer numbeh et elemevts
malmoa\i);
scomt-'Yd",Bn)
P C" £weh d elements \ n,
&st C=0 C<n iCf+)
scam "d*, s aha [C)
Phint ("Eten }he locafion dhehe yon d fo mBt
m eemen\n );
SCmb- 'Yd spoiHon);
Pidt(^ Enfen Pne valne o o inßet \n");_
s c m (ty.d , s valna)
o c n
-1; e>=PeiHon-1,
=
--)
arhotC+I ahar'T

Pin (Reslmt ah is /u ")

Phit"vd\n athayLcI)
benm d

Date Teacher's Signature:


Eteh nnmbeh ot- eemet alnaz

Entel S ements

E ntelo h e locaHon whahe ou disn o fuae


om eleMent

S e he vadue 66 tns e t

m empa
w a t e a pingnam in co delede an elemen- tron a
v e n lor olien |n om etho

Tn
# inde spdio.h)
n madn()

ahoLIoo], Porllou,Cn)
PAb ChEneha mumoeh dt lemeni% in ahog\u
B onbr ("hd', 6n)
Phit Chenfuo . d dements \n , n);
tro c=0 , c<n C+*)
3comt C'1d", 3 ama LC);
Phi ('Evfelh me locoHoy where gon dUMtodeleBe
eme\n")
sCambC'1.dv, spo3itom)
boo (e- pozilHom -1 } ch-1 C**)
ahot¢] ahogC¢ PI1,
Pinb (Resufom ah \n"),

Prdni 'hd\h', asho £CI);


hetulm 0,
J

Date---- Teacher's Signature:


Ehel hwmbeo d mensn a h o

elemets

40

her tne locaton dhehe yon n PodolePe leme


A

Pmltom a
40
e te a Phoham. in C to seanch m ele ment i n an
Aaha win Lineab sahd AlzoPabn.

inclnde <4tdio.hy
in main ()

wta f2D], i, x n

P i t - ( " Hod mom elemen3 ? *)


scom C*7.d ',s n)
Pí C"Eteo alma elemetS n"),
to Ci=0 <n +ei)
scom ('zd", s ati))
Paiv E e elemew Po s eaneh "),
scamb (". d", sx),
bo Ciz o ien fet)
a t 1-=%s)
bheal
At Ci<n)_
Pihnt ' el2men bound av index va );

pint( "e72mev w? ko ");


benbm

Date- Teacher's Signature:.


c
Hd momy eemens ? 6

6wen a o elemen S n

22

44

Snhue emer bseah 33


leme bound o fhdex 2
1 Dhte a phor o m hC o Saanh om ele men in a

alnn w Bna Sealtn algoit

Incnde <s}dio.h
Inmain()
hPC,H hA, lard, mddle, n , beavn, olnaoytioo]7

Pizinit-("Entelb mnmbeb st 2le ments\n")


sComb-'%d', zn))
Painte (*Enten d gens\n , n)
scamr C"d, 3aho te))
Point(" Sein valne Po tind \n)i
Scmt C*s ", s seohcn))

1o =h-
m idde -(6ht+lovB) /2
Wile CHh <= last)
Comaz [mldaa <seandn
t = middle+\
Ås2 Ur CamaLmidde == s e n) }

Phintt(hz.d bownd af loaHon 1.d\n0", seand

Vmuddle -\)

NDbouns d unPhese fh e n)
Date- Teacher's Signature.
bnfelo numben s t Ele ment
A
Ene 4 1ntegeLs

20

40
Stele value }o Hnd
20

20 omd a ?ocaon 2
wolhe a omam inc to beobatm $7ack ImplemevRi
wi almo, C pUSA, pOP TRA VERSE DISPLAY).

int staa<[io0],chotce,n,op,x,
votd P n (votd)
oid POP (void )
vaid dinplaz C(void )
n moful)

top=;
Point-C"\ Ewfeb he s/e ot STACL [MAx= I DO7:
s cmb C*. d y 6n);
Pi ("\a STACk oPERATION US ING AeRAY);
)
Pit(* \h\t 1.PUSAn\E 2.PoP\Alt 8.DISPLAY\MIA
4 EXIT)
do
1PiM-( \n E e he chotce: *);_
Scomb C*d, s nefe)
S t u ( chota)
C oel 4

P C);
hea

Dete Teacher's Signature:-


Case 2

Pop
lheake

Case 3:

dipla)
heaki
Case 4:
ptaintC*\hiP EXIT POINT);
bloeak
3
detarvtE:
Phitb c \nt Ple%eheh avolid Chota|

whue Cehie!:4)

Void PUm ()
Cop= n-1)
Pint-(*\nlt sTACk is óves blrd*); }
elR

Plnt+( Evteb a volue to lbe pned);


topPt,

Date Teacher's Signature:.


pt. No. Page No

did po )
iCop<-1)
Pin C t stade is umdahblod ")?
Pi6 "h1t The PoPPed elemenfs s 1d

sfackTot1)
tot
od dis4largC)
Clop>=02 STA (k
Pin Ch\n The lemends ih

phine C"\nzd ', sfackL')


Pn( \n Phnek N e chofe*), ?
es Phintt (*n The STHe se mety)
Ewte ne size dt STAC [MAK=1oO]:40

TAC oPeRATI 6rvS USING ARPAY

. PUS
POP

3 DIsPLA7
A. XIT

E e he chete 2

stac is wnde 4loiw


S e Phe hof
Ee a vlne bbe pune: 3
Seh he Cnette:
The eleme s n

Phess N2x Cuate


e he CMaa 4
I T POTNT
hlte Phoam inC }o pehtotm siack implene
ntalion
2
smetube PUSH4, POP TRAVERSE/ DISPLA)
sin

#incdnde <sdio n
# in clnde <sqdil h)
hpwm (shmeP s2ackxP4);
pOP Sme Stackx PI)
h e o k 41 mt s Pacle P1)
deplag Csma s}taux PI)
shm saac

Sf2e

N)
wmodn c)
i c h = - 1)
s m e s t a u oP= (sHmetstace) mallx (sleect(stmfsPacu
P i t ("Evte nad mom elemew o n w a o fnseht:\E)
mt C d", s ND,

P sfzeeN
mallst Crm> sf2e+ siz2ot (inp)
Pt P (fi*)

phind6-(2nter fha wo} fo do.. \uP.


Chotce on
dsplan Choae\t);
Pwm\ Wta. POP \WA3. peak \ t 4
Slmb-C/d sCn)}
Teacher's Signature:.
Date
sogcuCcu)
cas 4 pem (PtrD}
heak
Case 22 pop Cpta))
bheakk
ae Peal ( Pa)
eal'

dsora Coo)
heak
M* Zhe mo8hom ecfovu mocs
Pn 2

binSned \h"))
lheale
detamm

nmber
betweenIo 4) \*);3
Cch=o)

pu CSPu s7aclea pa)

At Cf Pop == PI- Sfe-1)


P i v Chs s a overtlod Cvndittou \
C o uam no inset am mwmeb heure)\"),1

Date Teacher's Signature:


P1- toppP
phnit("ente he unhm bats ou vdamj fo fngeist\u
Scamt (u/.d, s);
91P IP4- Hop1- P
hwmbelo i fhBented Successgula

fnt po CSn Hackr PI)


f

e1e

PI-Pop-) 3_
f dispra (s?m Shack PI)
&PI > op=s-1)
pint The Aacle iempig\n);
P H(The uue3 aher.\n)

Phid ( d > > M, P1 P7)

he md
Date- Teacher's Signature:
m Peak CSm sAacde* P)
CP1 Po=-1)
Pni he Stack ls empry\n ))
elae
P i t (" he peal numbelh s Vd
PLPLp A-> Pop])

neumn D

Date-- Teacher's Signature.


Dhite a progom inC }oPerbetoy qnene jmpl me ntalien
i n ahhoy
indnde <sPdih)
f h d d onio.h)
detine N6
inaTN], thn-1, oeah e -1;
enhene (vola)
h deMene (veia )
n Peak (vold
disflorg Cvod),
int moin ()
i n ehz -1 )

Duiie (chleo)
Ptrntt (" o.Ezif \n\} a. Enruueni?z.DeaneuYs
ne Cneica
Cndia :\+);
SComt- ("J.dys h )
Swg Cch)

enamews )
oheak
C asR 2

deMnene()
neak-
C 3
dis t o )
sh esk

Date Teacher's Signature:


Case d
bheale
detant
PiintC1tLnvalld înou? EoomEno Ds4)\"):
33
etwn-d

aetn

Semb C n).d
k
sdata))
*,
Cbear N-1)==

Pm C*\UNSUCEssFULL \ The daka ë nat


insaed
k
i(toov -i ss
h2ah E-
=

hea+
ALhea dala
bepmo
) d e ame n C)
Ctoon- == -l 33 bea=-1)
&nene2
elze W C t t r o n F= bea^)

Paintt( The data is deleBed Successéud )


otoen-=-1
o eo -1
else
Poin (The dota is deleted Sunccessbruli)

hetnm ;
n dBAlo )

(thoovte z-| Es heah i s -1)


Pmn (Y &ene e e mpig \ "

1 p ie (nTheAR ahe d o a e daha\n;

Prrsnt (Ayd ,at)) 3


hewm D)

Date ------- Teacbor'e Ciana


UTPU1
O: Exit
namem
2 De mmen
Ds
Enten ou Cneie
Ihsent 2
Enteh n e dota Jon wOemd fo
The d t is 1ehed SutCerbrl
OErir
namen
De mane

3 DUt2
2hhe heite
edata on samt to i e r 1d
The data nser?id SuccesKbull

nwmen
2 Demel

Dst
Eel
he ahe dota
20)1b,

Ehameine
2 DeOme
Dl
bte apooaham inc lo Sor am Abto w i Buide
Sor7 A7ordm.
Indnde/s}dio.
indande <eodo.
void main )

Pioint ("Ente the Site ot aldog:"


Scomt (kd ",gn);
Ptlr ("Ente» he Elamen, ot te aha )
bo Ci= 0 i < n ) }et)
scom(d, aph ']);
Phin("ElemenBs oh he Anoy betotr Babking "),

Pofb- C"d V, a )Z
hotrC1=1) 1<h) ja+)

i(at [ >am [+11)


m b aloto TI
am[J: a t TJ11

P n Elemenso6 lhe antrrg abBeb Sonhn")


on Cia 0ich i+t)
Phi ( d ', ald[)

Date-- Teacher'sSignature
Fe he slze ol }he an2

5
Eei ne lemen?s ob Pte alhoz
2.0, 40 so. 30.6Db

lemens o4 }the th betone s-H2:


20 40 50 3 0 G01
Ele mends ot e Atha abte St9
20 3d 40 SD 6D]
e a phoanon inc fo sot om biog i

nclundeeBio.Luy
n a nde. c o o h
vDid moain c)
101, n, min
i n , 5, Jemb, a
point (' Enteh }he 6i2e ot ahag"

Pain 'E }he Eloments dt e thha:")


hoto Ci-D í<n i++)
scamb C'd', 3 a i1);7
Phin('Elemev?s ot fhe alha betohe 5ting: ")5
berto Ci=0 i<n; i t )
PtainR ' 4 ", ah[i1);3
troo (i=to,len-1i)
min e 1

Calnto L] < an T min])


min 3,
mp ah i1
a h 1] - a b l min]s

Prinlb (' Elemen?s he ahhog at7e S cotin,)|

Poinrt ( "/.d', ad tiT)

Date Teacher's Signature:-


Enten tte Slee o6 ahoa

s6 te thoj
Ene tre eemends
Is, 35, S5, S, 25
l e ments ob e almo bebe SphRing

ETe menBs 06 he aldharn affeh Soh#

L515 25 3S SST
W i e apmam m e s 6ov an altrog u i
Tnsenion sotl 1zbitn

# incdvde L3}did ny
# indude <eonio.h)
void main()
int3, Pemb, ab [i0],n;
Phoint (*Bnteh }ne slze o6 Atho: "),
Scamb "),d" , n);
Poin("
( * n e h e alemens ef a Atho:),
to (izo) 2h f )
Scomb C'7d", s ahti]) 2
Phint(Elements ot ue altna betore Spts}in);
ove Ci o <n t )

Prrin 4 (" Y.d ", amt1)

emb = aln
tato(i-iiz06sZemb alt Ji-11 d-)
a t o IJ1 a Ij-1T 7
Proin ( "E?2mens ob Pna amay abteb sotoPtng: "}

artotD

You might also like