You are on page 1of 25

21sc1202 - DATA STRUCTURES

Week-7

~
f the Session: -
l)lfCO
I
-
I
-

-nulslte .
"'""eue - First in First out
• QII c ha!I two openings
1
1 ~tll. Uy FRONT • REAR • -1
. )
Time of the Se!lslon:

--
to

Int
Operation _ lnscrtmn - Enqueue(
: Operation _ Deletion - Dequeue()

tBlfbJask

I. Slaow the detailed contents of the stack after performing the following operation, and w<ite '""in., ~
....,_
dDcpp(). enqueue( pop
push and'P'), operations. enqueue('P'),
dcqueue(),enqueue(' A'). enqueue(' U'), dequeue(), cnqucuc('S'), cnqucue(' H"),

-{ \K\.~d,e < ~ •o,~ "':>

\()I~ e,._~°" e ( t. '-'civ) ·,


\A>id.. ~ C t . ~ lj

'-~cl c:l:s.~~ O_j


~ ~ t -::-\ ,'"lef:l"<";:. - \. ~
~ -,v.e'"'a t,oc~;
,~\:. s·, 1e :: b ;
\Y\~ f'4\Q,ll\(. ) (

~'-'.eu.e (' ~•):.

~"'e'"'e. C.' u ');


cl.e\'(~<.(e <J.:i
eA~(l.(e l' ~' >:.
~"'°>- ~ewe (. \ ~ 1 >;
ale-,ue.i e. c ) ;

C' r ' .) .i
'e.11\~~ \.C e

de-.,1.A e~ C) )•
~~"'-e { 1 A') j

~ \ ~k~t) J
v:, ,·cJ.. e ~ e Cc. k ir Q.(. e) ,t_

i)r- ( ~...... =- :: ~, ze -v-(


pvi 11µ <''OVe~La..;> v, '''.> :,

€.be .(.
ft (¥/It .:..::- \ ~~ VfE."Q.T:::: - l j
~

'r'"8'.lY-f-fJ
~

~e<-(.e.rr-~ y'J ~ eJe j

f ,..;,,._M- ( \ \ (- C. i~ ~ 4 ~ ~ ,,, ,~ ~ J;

""'tol deyu e ue ( ?{

,J ( ~Ill -: -=.- l )

.t.
l>MM (" U)'\de1-~ w \,/ ') j
J,

e,be_ '(
f»' )i ~ (' ' ·/ ·c.. i.t d.~....e,.,.J,.._ \l"l ''.,4ue.J-te. r,,. ~ nt- J ~
1°k (..\-vl"ll =-.:. teq¥)

{
,f-K,nc :::-1;

j
~
"°i cJ. cJ.;sp~C ) -:i

<
wtion ,m"t11'i11c 111 c ,)tlllelc,jlcld with th N
uw•Y'the 11111t b,>~I"· Imp Icmcint queu~ u ei . numh er of Bagi
~ etl~,,e( ••~,uie
IJI, rt
t SLL, Opernt10,~s Which are con
u11in1i Sl111ilc Llnketl Ll11t. Te,u tl~.."H
11.,.. , do
r • ..-.htll•
""• ., love p s are crention ·nected tn
ft · one d'
· SLL
rngrnin using
fl"~ for II , 1ns-·
... ,,on, d I .trecll·on
_,,dll • menu oPtio ' '"on Ind

~-, c~,v-' ..,g.._c: ~ •o~-, ns.


~~~~~(.:~ k')
\
,JJ '"" ..., "
s~cJ.. r\" &t! "-
intciAV\~
~c.~ t-od<.t ,._ l)!i,d: J.

u,a, ~--vl,,( ~"4t') :,


\01ii. k ~ t'-4 t <. ') ~

\A,;ol d,.c'!.~1 c. >~

~ ~ail'C.) ~

'~~ c.\..~c.e ;
~ \e t'-){
\>' '"t-\ (" \ •cl"l"),ue,gc. \ n J . ~ ~c..<a.e ' " ~. t) i~ ~~ \~ .y ,e~il \ 11 •) ~
~"t~ l '4 O'I ~.,. ~ e c}o ice \ n '' )~
s~ , " i d ';I ~ d,o((e)~
~~ i-l<:"" (.c.w,i ce ') ·
t CD~e \ ·• o-ii, ueL<e. < ''/
»<e..~:.
~ l- '; d.<ayu0- e.C1 ·,
~ ye,_\: :

~L l : ~f>L&.j<: J ~
~~}
~ee 1-1 ; e'lti'i.t .,;~
de~; p>i"ti C'' f "11cil.d ' t

j 1

----
v0l &. e_no.,v.~,._e c) ~
~~ >-.o&t! -+ ch' ·=
~&,~ne·,rf-:- rJ uL L)

l~( ~;; .:-1\fUl'-) ,(


(I> Yi I\~ ('• 0\RV,-\{Qt-J \ h ~ )•_,

'\ ~YI\; Y'


e.lJe .i.
'Pri n£-~ ( 'Gl {.(y -l1e e.J..e~ ~ 01-v,,e.~ 'r ~
.s~.+ ( lf •1-& ", 12. ('~ -) M~ )5
r ("'°nb~.:- rv ULL~ ~

.( ~ rk 'i'. ~)

\es,Y t r::' j
":>

.tCA- ,l
rQ.c'< ~"e><l.:- r:~~
,y~v--::- ph:,
)
~
~

"° ,d. ~1 (.(e.. e< ).C


s~c.l ~ do- vY;
,.+ ('-i-0 l"l- a: , NU 1L) ,l_
('Y\·~t -+ ('' u rder-H,::,i-<> v, ' ) j
1

-,du ,,, :., )


~\.)e ~
f{,- 2: ""~l')t,:,
-r-,ol\l-:.¥)rJ-➔ n~ ..i

dre ecr{.,-);
~

\.,o\d. cl:~~ ) (
~~ roc(.e "' p(;-r- =~t;
,·~ (.p~=- ~ NULL)-{
~11HCt' (3) tlf'u e ,~ e.,.,f ~ \11 '1~;
~,11:, l
l.J...' (.e t t" I , "' CIU. ) {
pri11H ("·/. d ", p(r ...\M<·);,
f(.,r f ~ -41\~c-.:,
- --
21sc1202 - DATA STRUCl'UREs

t1sk
~eue

1.

y~
~ 2
·ven a sequ
1iave t,een Ogtf operat'ons
types
1
.
ence
.
on this hst: •digits. Each digit in thi, leq,,cnc.,
A ofN
the end of the hst .
range, rr..., 11q It)'} . y.., ,_..,

V-::U
_..fortD)· Add element x ~o
maximum element in the current llequence.
ha .
~rP\.,._ · )·. find of
fdax(list
ch query thetype 2, you need to printthe result oft t •-•lion.
for ea
,cq,s:JfwWW.bac
kereartb.co
---'algorithm/queu
probleuu,
m/procttwdot■-structu
es-c:ontent-problemJ ...1,r-,hc•l"••lorhy-11•-•r..,..._

l.

\lc:tcl.. d..s ~ l )
~ .
-~~ \ :.
~ C~ "l -:: -::. .., J
(->rt·~ C'' Q4e",e
e\;L t.
~y-(.. \ ~~\O~-l:., \c:. ~ Y EQ'r; ~"f- "'t)
t>°" ~ ( '( .., .cl ,, , '\, u 0-t e [ I"~ ) ·,

~ v- (. \'~ i -= ~n.\.:, ~ y ~v- ; ,~-t-)

~ C~l.le"' e Cr ) ~ rnct>c~

~ t" ..,-d ~ , ~ 'l t.. n, J ~

~ v(, ... ~t) ; \<'."l '-'C NI '.., 1-+-t-) \


RUCTURES
21 sc 12 02 - DA TA ST

ati on sy ste m. The


me nt pla n wh ich is ba se d on a full au tom
~ •ty mall de ve lop d fo r the
. se wh o ha ve reg ist ere
.th a b1gh-c1ass c1 movies sh ou ld be in su ch a wa y tha t all tho
for
working WI that the entry not be all ow ed .
,u are the on e wh o ha sn 't reg ist ere d sh all ram in ord er to me et the
, 1er bas said to• yo
eas
u y whereas
ha ve to de ve lop a qu eu e pr og
.
iJ u as a pro gra mm er l h rin g the inp ut
'vie can. enter in as be en d o.ne and yo rm al t . e qu eu e op era tio ns. Du · na me an d'
' lw or kh r. Yo u ca n pe rfo th ha ll. enter its
Iteehn•c& . . b the ow ne . th us er s
d d fu rth er m e pr og ram , e
·ared conditions d ytickets are to be up loa de an the req uir ed me ssa ge is too dis pla ye d.

t er namehich~ts to be checke
customber
et num w

oblems/KCPROG4
d in the da tab ase an d

ll:tftnn!,codecbef.com/pr

it: i~\I,,( J..e c:.sl..ct:o-n.,


-tt. ;"c.\"'ol~ LS\-6.t. \,-h-::,
~~ _9 rlo .t \c: t
~Y'k ~{"2e -:,
\Y\\o -b>'? f ~~ i , ...
() ~~ J

~ >
c. ~ po -)
i.s ~~ \i ~ d s~
b,
, 11 ~

-l ,~ C& ➔ t-:-P -;- :.- ,)


<e tu .vn ~ ~

'f e.. ~Y n O ',

'J
k( I:. ~ p~ , 'h t I'\ J
"U1ol (> '1- SJ ..( ~c _k ~-

()~~~+~
('~➔ ~t .C p& ~ bf
'7 ~ n_;

~ C'..,k.' f4'v ,"i? ~ 1' )


~o l_ f>'c S ~ I { ~ b<.,(.}l
~..\:- .a
1

J.

c-----__________________ _ r 98 L
1,)1';\o;u, ... wn-· ... " r t-,- )
,._ . , .. \,P\~ ft>r( ~~,. .,~ ~l 41 CII"

i rtv ~ ~ r> - ~ j
"'
t"'- n, It j
~I'\ ~ l.anj ,'IJ -i 'jt:

3 °'-'1 ( " •lol. ,IJ.. ~, .c n, Q. ir j J


~ ~ ('"lj ~

~ v( f.11t t:-o ; ,<,,; ( 'f 1 )


(
Sc'"'d-( ,, .(.c( >
, QQ Cc' J ):,
)

~t.A 1~c~ • s, ~ (l ~ti ! ~ cl- -1 _) Mc;.11.ot (.s rzeo(- (.s-twck .si<'cll) ) ~


st ➔ ,Size.. : "' '
s, ~ (,.. p C. 0 .J
sl ~~~ ::- C,u,-+) '\'1-,Q ti oc.. (J rz..e"" ~t>J- ) ~ n ');
.Sl _., sl u,~e'l ~ qra:1:
S't ➔ ~ ~c:>-:: ( ,•kJ- •) ~lice. t .s,·zea-\ CcnO .,,. ti).>
~, -\ R r3, ~ br"}t o /
iai,~ o.J: ~,·.)
~ l~ i r Ij i < ~ ✓ l°'tof J

l ""i..·1e (J1 ~ Ht.>, ~ bip1 '::» ~n:i 2..e '- ~&.f~ Cs, ))

.t '90) -- ~ - s, ~P ~P c~, ➔ ~ Jf ' ~


.\- -:. (-t + poJ) •/. { ocol.lC\l~ ll l

i I (.,,. l ~ C.. -1 1-t J c ,._ .:,c:;-.1 I I ,) l>,.p';, (., , I)


.t
r 1..1.11 " ( , , , c, C"('J ) ,
f"f~" I ( 11 I I) •
j
c.°'4\.c 4tJ
ue usln
ue .h h op .
I!( QUeUe using arrays wit. t e following erattonK
if(iutar erflow" if queue 1s full). ·
,. ,C
~ 1 v ••Q\I
ov
e11e .
V derflow" if queue 1s empty).
~1e iSP\11 ~oueUe n . )
IP'.,c (0 . 18y L if queue 1s empty .
If'·.. i01sP I v ]111.JL
~\" iSP 81
..i,1l•Y (V e is 8 linear data structure. It follows FIFO . .
I"'' . lat' queU k . I pnnc,ple. In .

? ""~
t,il ftie cifCU e first node to ma e a circ e.
to th
circular q1Jeue, the b
" ..n, •

,_I
. ~'111.hackerrank.com contests 17cs1102 challen es 7a-circular- ueue-usin -ar as

~,"c.\-6..e ~s~fi.\'c,.~?
-tf. t "<.~~ e £S~l:\,. ~'>

'd&. ~ )i
\,\':ill. I..~ 'j

~it cL·.s\'l'1t >i


~-r~"1 ·)
lkk- ,..·u.~~ j
\N. \.,nl ~ -\ , ~ e r-::..-\.:,

~~ mav-ic ) 1.
\ ~ c:.\,«,,·cc_· J

w'--4'\e l \) { . -1·& ;( vl J;
. ~ . d.'.) p I°'::! \ll
~v, ~P..l '' 1 .G,~"'E:"-.e \., i,. O E'5 ~e<-e.\n

(>,.j,Jt(''&~v l'\-e c.ki c.e'' ) ~ ~~


.... ~ t ,,-,.-~./J t I ~~t te) ~

~ i,.,1 'l(l,,(d,oice)
~
CA.)~ \ ~ 40 j
\,~ le j

e,e.x 2.; d.1c ' j


',ve_q t ;

~ 3 ~ ~.) p4'1( ) ~
~Q. r :i
cle!o.""( '= ;
Q~,•v,.>/·

~n, o:.
~
-w,cl..~c.) ./. .
rJ:- Q.tQ.;
~c~ ( •••td ~ QdeJ~
i~ ( ~ l -= : o .e. Q rtnr : =!,i7e , 1 \I +-,11~ r ~ l-1nr+lj
P,.'.-..M ("'QI.{ "'~ over..\(ow ,, ) j
~ n,• J

t\ (-\-.o11{ ~ -:. _, ') l

W.::r~ o .,J·
l
e\~ <.
H(~ear -: :. .si-ze,-\ )

'(t!a'r f tj

,. ~

~ e C~tJ:-e1 e;, ~
\ioC ci clo,< H
,Hbnti .. ..()
-.e,l>.n,:.

E,,a i~ ( ~\'I{; l'. r i'e<"I-") {

-S-,1\l .. 'r6a.o< ~ -1_; ~


e.v~-t
,i,(.-.,n\ ;: 1 Si~--< )

~ t ~o:,
ts of the queue data s~crure oy ms~mng numoers 10, 15, 5, 25, 17, 21
73
·icd conten e after performing the following operations? i. Delet ' ' 0. Wl
dctB' f the queu e two elements .. I
wtJtC tents o . u. ns,
511"
I, dt,e
,~e coll
~~zO·
,1'
, ,#;o.~>
•r,t.l .#,
I' ~ctU\,\.i-::>
. ..,.l,,&e
,IJ \ ,..
'->
VJ'"' aiyt ')~
•J l-,.t .,.)
\P\ CI, I
.I • DI t'l,f ),
-~ 11'-' ) '
'-"' C:'\) -ls--;:_'(":,-\' •
, -.J:: \ \'t.e. =~ , -vue.\,e , ,I

t\J.- C"fl~'\t.)

(
,fl1c d.,.,ic.Ci?~
La>Wle( 1 )
,t
~Y\flt.~ \~' \·Gi',t.<~e. \ " ':l ~~cayve.....e\l'\ ~- ~\~ \r, 4,e~ \t , vi '')~
~rtn t:.li- t
II
tf'\ le-r 4.\-e c.bi c:e '' )'.,

sc_tt.,;- C'~ 1. ~ \ ~ c.ki ce~·J


~~~ (c.~~ce~ ~

Ctt~~ \: e<yc. )'.i


'm~~J
CA~-(_ ~:.. d.-;,c. ') :,
tree~,... ~

')

100 111111
ehe.
~c•c.,c,~ ~")~
""tV--7:.-' fl~"':::-\) ~
1~ rco; ~

~(-'e.~ ..._

"(~-t;
~
q,~ei..~(y-J ~ "~

~(f cl,-O{

I-'! C+.::~-t \l~~Y)


~ f ,ib~ ( '1 ~dQr,\Cc,...) Vt,,)~

~i"l~ (''·} cl i~ d~"ed.\11'~ 'i,uE>.u..e.[41 )~


\~ (.Is~: 'r) ,(
~~y-__ ,.
,I

~Cr>t.(; i:-~ '.,lc::~y, r+f- ){

{'1'~ ".,.d.. \,, '•,, \'-i e1. -et rJ ) ~


r
i' ) j,i1' er11e11t
if 10 'f1 cltl
the qu.,..
h'
-,,,e I IS,
-•e's enqueue operation so that the firKt cnt d
we need an
••
add1t1onal stack
. . To
. enqueue a
ere clement I 8
n .tlcm .tnlo th a way cnd,i up at lhe
the second stack, pm1h the item mto the firKt sta ·k e queue, firtit mo
:,6" c~ O 11 stack to . 1· c ' and final\ ve all
M i.t ' " i.e first sures that the new item ,cs at the bottom of the st k Ymove all cl......
' ,!.'" ~b•
1~A" frO t slllcJc.
-n,i• en
... ,e an item from the queue, return the •
top item from acth Iiand hcnce wc,uld be .the
1
...tot,
.
...-• di' fit' f O de<!" 0 " • " " •tack. ••l
rP to re'11°ved· •
,, to t,e

~\,e_ ~
\pp\ ,t.,. j
,s\=ac\c, [~~-:> ..._ cJ...a. t a~

,~ vet=>'' t..
;.1r t~t>' -:..::- \ ')
pyc' i,t,~l• Slt:IC.\. ~ err,~-y,1 ):

'-\)e.. "'
j" t O -:. S lea C. \.: \ t ~~ r:i·.,
b>p' - -~
~ ' \ . l Y f'I Q ~

,·~l~t> '1 = -- N-' ')


rr ,·,,~ ~ C'\ ~~(. ~ ,\ "IA'',\')_;

~\~ ~
~'\'~4-+ )
5 ~oc~ '). nx~,?l --=- x-;
I
I
e.-\" :a - .. )
1
I ..."'~'" ~k~""" t l

I ~ ~."".(l,J, .),
j ri-4)\ i(>r>J
I .. ~l ,f + ~ }
t ~
\.o ,, d.. ct e, ~ ( ' d• c) i

I ili- \ l"-'\)'- , ,. -t a~

et~ (
~~:i -s. a - 1 ) J

·>-v( 1'1-.'- t "- ~ j i < ~ nt;, i++) ~


il'r\- e\e/V)CI\'\ C ~(>\( )
1
j

\~\. = \=O~io~
b
t-,,1'{~ t"·l•d.' t b ):,

~T(I~ i-:-o~ (,i:'.h~ ,•~~ ')

~
\l\l- ~ .. ~~{ ) '.I
f'1.) ~ , ( <"J.) .)

~ ~
\oi'c:l cic\~~ (.) ~
~(c~ t ... ~~~<'&.~t;;r"f~

l
'
~
"'i''l~~(•II-/. d.,,
• ,
19L-.
~\:I Crl )~

\,.1'cl. l't\4.1'-,,) <


~"'-e(lc.,~
°'Y-e11 ~t.~. )~
~ ( l , \ ) ·1

~,~ o·..,
~•<'lo)~
~·~(.))
~5"....
i 11:
''
~
jlll"'*~
1 the Head Chef) are standtng 1n que~e to submit their bills
_ ,e,cept 11 re are N chefs of K d t!Terent seniority levels. These a ·. The Chef, bav,
·
.,at,Jtejs
~It 1"' en'°" (_ty. In all •~enote the seniority of chers in the queue, "• denot: ~ven to You in ,.
...,
s At. A,, heANqueue. . . . . ont of the qucu,
dilfe where end oft .. thought past his head, He begins to think what if every chef stan· fr om
y otes . terestmg10 . . b f b 't . b'll h tng
,,,.; c1en ts an Ill delegate htS Jo o su m1 hng I s to a e er least ahead of him i th
Clt'r!e
.

~ ~
,..ieod
quell
thC eeObutfcbe
JUfn queue an<I m
fe fulness ~ Head Chefs. mind.
fu
queue _beg~~e Head Chefs fear In~•• of this scenario is r • 12 - II + t, where : ~
r,1 of. ,or to hun, 11 1, the index of the Junior chef, Head Cher s total rearru Ines, or chao, 11 is the
f . 1Note ir a cher has no junior ahead of him/her in1the
nthe ar
~
. del fulness for this Che . 1s .
th fearfu Ines, given an arrangement of Cher, in a queue.
P'~~ethen of•H~ed
q11 are requ
d Chefs
find
toan fear
be e_H~a
quite ar outputtotal
dgeChefs it modulo 1000000007.
yo11 . number c
· ili~ UE
odechef.com/problems/CHFOUE
SinCe
~,c_
l!!"'am :-
~<-~i ~ . 'r\":::>
~ ,nc..\v.
, u"'~e <~ t
~ u""•"'".:>
.. \ti

,.,_ ··e,t S tQC.~ ~st. . ._ r-,1..-t.\ •


~ \f'lt, SI~ I ~~ " J ,- i°:=.:1
:) ~ "-• t sb,c(tl S~«.
\:. ""~tr_')
,n-l :,, r~
'-"TI\"''-l
g

~ ,.\ ( ~ -to~ :: = - '')


~ v r , \~

~ft.(.\ ( ~tt ~~~ ~~)


~ i¼ ~..,) ~(:) -.:::-: {>{v~1,e-1)
'<Et:l..l m l j
Vl:ci ~ ~t 1 ~t.l S>',a(_\: .. ()tr' '('I \. "') <
~ -=> \!;:,~ ~ 't:,
~ .-;:,s4:: ~v ➔~t)'1::: n _j '1
_l
\,0 i:o-.
n..,.'!!)',..,
,· \ t ~tk ~~k • (>b- t ,-..J- 1'~ ,(_

'Ptr~ ~~t~lc:-t- , 6~~ =-"'; )


'--'' ~ ~~
( .1.
~""u. ~le • ~
"""' ') {

,'Jc ""°'"t ) ~
'" Ir ",\<. )
~ ~" 5 vk """ ':. I ;
s=....-\- l '' .,:ct "'~d. : D.." I' ~~ );
Mk ClU\J':,
~y( c'>tk [=O~t<l'\j{-f'f) ~

~~••__,,-ct~ :a.. c;i Cr"Q,

gl ➔~C-z.e.. =n;

s1~ L"Df:. 0,
.S.l..., &'\: :- C. r ~ ~) Yl"'R\ lo <'- Ul '2e. t)-\ ( t.J-) ... t\)~
p~~ -=- c;.J:. .. ) ~ C . (.lt z.eu,\(/-,tJ
!.\......, & Fi ) •

SI ➔ p(...f G, ➔ ~1.:: o:., .J

~ l.::>n, ,""\¾ fCS _;

8ol-( ,· .,,,t.. r-= ';. •·<,, : t"-f-t l


~

""'t:(e (.1(~ 3~WI ➔ ~J.::::. qu:J -Q_~ '· ~ ~~ wlJ.J


-t.
~o"' ~ r - ~, '"> ~~u1-) t...p1~,,.
~
.J

f-: (:\ ""' ('Oi) "/. I ooo coooi


&:bp(s, )..)

~ ~;,(.si., crc,.J .,.i


'{'(.(li. I ( 31., I• ) .J•
~~e.>
3
~-\- ("•I. Ud. •~-i)j
~o.:,
0 of hiH now hos1,itnl Whit~ he 1 cl Ill'
8
P tn c•hnrg t '°'
llk1y num
l •· d f ·
c I
111111 I tu NN •nch ti
' '"1& l\l ti
ie ''""h N
1 D<,ctor , IQI i>Cr'<>n )()( b . N 1>%p1, ha
I· .J "'1 <1·oh voh• • ll<>kC<t • . ,, ...k
I' .. , '{
f· J' , r~ dO
1 ~ "°' "'
, '{. rilv 11rrlvo nl lho hu11p11n1 on tiino ,
"'""''" , . ' ' 1 Ylln doc; I
1\11 r,11 tho n1,pomt mono of the P«>plo Who b <c nf •n """••
"1>1l,,.ll\cno b • "'
.....
If._,1Y'""',rle thC stnrt you d -,ctor) otherwise . you Iook ",or next 1tvnllnhl Ookcd tir Rl (Ro if Pera1Way or• L_•~ndling
11' ,~ ,._, 0 l the l l . . e PcrRot1 on l a .
~ ,f• •,,.,.
•Ill'"1 (111 e,
n,cc11
1 ,tent ll
f nny pcnmn Rill t1,e,r exist some people (l ·
or more) Wh h
11
II
va,\ab\c
..,~ ~ arroit tyct thenthoscpeoplcarcsuidtohuve mi cdth . . 0 avebooktd .
,..,I' 111',,1(1II thCI t thC hl'•st>illl xists ' 8 ~ct of pcor1lc thut huve missed their "1111 appo·cirt 'PP<iin1 ll\cnt. "'I"' but
••• ·,cd thcr• c · · •n tncn1 tar\ic,
,1' 'I ..,rt . of titllC , ntly nmong them (Inter thun others in thut Ret) and the Person wL-
<' •nl ,st rccc say pc,""' )()( · •~
II' .,. r< . ,..,.t "" · . to mcot the d11cl11r over nny 01 her i>Cr,on But . " now "•ilabo,
.~" -•''" nrionty . .1 \ · even If any P .
P ,tJ 111"' • rcn the ,. .1 blc and XX 1s not nvo, 11 lie then you Rturt appointments f th erson 1n that
~,.(.X•. f"...,nX•X 19 . avRt " •n their ordcrofbuokmg. • o e peop\e Who ha """'
~ -. ~ II"' ·ntmcnts ' . I h . I h .
~ '""

ti,;,,-~
ti''

· ..-i tht
. art f''CI\ the"'
arro' d in w llC
. t/output "
I . ,, people l\l'flVC at t ,e osptto and ave to print the order of th .
. .
me tilll<ls. Pylhon users •hould sub1mt thc1r ll<llution, in pypy 3.
.
ctr appointments
·
,·111 r.st ,npu
t-li«: tl$C
toduhef,com/oroblcms/CAC202
--
~
--

f \• ,-c,I "'c,.._j~L~O-'-l ":>


~~ .-.;;it) (
; ~ t")

.! CQ\'rl t ,, ,td, :." fcl) ~

t..:>~'le {t:---) 4_

~e.°"..; ,-i . /.d. ·; "'1..-'t'\) j

1ioJ:. ~ c" 1 , 'oo~t,.:\., h~ -:.-, ~

):,Oo LIJ ~ Oj
~
w~'I~ C'l--) ,l
~ •y .a1 1., ~ ')( ).:,

~ (,>\ ~l'n) {

{''ii M:tl ( 'I -1.J.. ", ?\) •,

Jp,, u~ ,-= ~, : '•.(., .___ .., iff) ~


b V -t--+- i
S[lop'1 o; ; ;

10:
'p~ (>e ') =- ';
~ , e( ~~ ! ~ -, O~ b::P '( ~ ( ~ J'1--.. ~ , J~
~ r~r~'J] ~ ~:,
l'"ili , ...., ~d ..: s C~0 3 J~
~r--J
:,
'-'.;)½'\e. (. lo(>~ -:. - \) ~

pn ..A:~ ~ < I r-f . tJ •:, J r ~\'1 ) ~


~e--- ·~
·- ~"r>I/\-:,
,Ii.

~ -I
.,,.cJ""&e
J.f ~.)
to~·~·t.,>
1'rl,V' ~
j:l .t ,,od.."
·J, a.,, ~a i
' ~V"'
\
t Y'«l e ..\
n~>c-t.,;.
~(:_...,.C..,.,-

L J. '(«J,Y j
,,.~,,~ I

' j tl'A- (A E'.e (


,' "
iw10'-
\I-'>•·(( c(e pt e... e ( ) .:.
~ ticJf lPj ( ) '-'
'..k f"' .,.:, " ( ')

l ~~ c~icoj
1.,.) ,.c'l~t,)

i ~"'"1.-+ (" 1~g,~ae "" 2. ~ ~ e . . , ~ ~- () ; ~~ \,, .,_ ~ c'~ \.,'"' J\


p ;i ~ C' e,;-,,, ~ -ttL CJ...;:,, 'c e '->i ,... ~
~,~c.~ Cc.k cc.Q)

~
c~:a e ,: €-11 ')..-L<e=t. e t ) .)
t.:>~(c ~

~~ .l. : ~<ecj t ! . t ~ C ) :
\, )" ~c:::: \c ~
lA~ \ ·. ~ ~j p~c:,;
\, 1--e~~ :.

~-<. ~ ~ (cl"(. l {f OJ!


~y ~ ~f: j

104
~

~ )e -'
~ ~" ~~ ~ .= p(y;

~'(;~~~

~,...& ~e.e c) f.

~cl~~"~ ~
,l( ~,J;:- ::::N" LL I

~ - : ~--l~ l) ~,i.:{)
-t-~ cf)~>~

JU IQ c1, .a P~;
P-=~d;
,\.(► ~=/\I "t( )

~ ,-
"-A.~,,( «"lll. f
......_ "- "111 «J

'
l ,\ "'~ t ·..
,SC4'rt'' -.,d•,. ~l).:,
~~ \t t ~--)
l ~~ '· ~o~~~
s c~ t "' i .d \. !:t no oi ~~ \:,

~-<(,:.~ ~ CC()cmt)~\ :,H )


-t
~~~d t ~ --,.J,J..tJ >, ~C't't ti·l) .
J
~

\.(~,'9'\e.d ta.-,~ ~ ~~~ , ~l?J ~ 0~


...sc...~~ t '' . /.J.J.. t(. ~.. ~ .l t.,"'J~
boo' ~~ ~ +b.!J~:.
~ { f-:. o~ ,·c: noo!Cl'\f~: t~+ )
J
l!.n~ + -::. e. \ yr,· J.:
t,-(~l\l.,:: s ',n\)

j
l on ~ ➔ :aw- Ct J',,
\ -~ ( ~ .-..> ") ~ l~"" )

I ~-- ~ ~;
b~ak;
~
,., ~~ ~ -= 0 )

~ ..,..~ C .\./et,,,', i f <)~

-'lt!,e ~

,-(,,.. ( t~ ~·.. i c110~ O'Y~ : l -t1..l

'
')

P"~ r•. ,-d ' " .. ~


Q,,J"f c) ,
.,
~ • •• •

~~e ~ 1 ~"o.'-\::>
-ii:. (\(...\(A c,.
11 t" L ~ ~ rl \1'3 · I\'.:>
i i,,d .. o.
JI. °'r(l ... cte ~ tyr::ttJ..· \.-\ ~
,-' €rt a '-( e,_U~ t ,'-i!- '.) ~
w1 eo. "
I.A4~c( c/.. ~"" e<-t e C.. l:,
""''&.. pi ~ _el.e t,.:,
(\.t ,\-atl t ":. - 1., Y ~"(""~ - l _. ~,•2.e ':. f OO~e>~O~

,~ t1. CSt?-.c1:.
µ ~ O:n C. ) -l

sc~ l).J t ,, -1- d. t;-, ~ cL..o t' c~ ,


,I

~ i +ct., CC' L,,)\' ~) l


Cc...>e.f:~
{Lt- eLe;
.s:CA+ ("'...,,d..i .. el€.)~
~~~ E.( e)e J;
' ),y-e <! )c. ':,
~'.L !).', 1
Jf21YA e"'t:. (.,:,
\,-tee. " ,

,.t. , ,.
~ . ' _,,.., '~
e"~-~
\.,yeo. le. .:,

tw'.',>-' ~e dn~ ,. ' l


,·~(-\~ l :.: _, ~~
-.e:t" ~ ~ -,~ t
.Jj..on-l +t i
n?qt- ,t ,t j

~(~""' ') =~~


')

~ ,.., ( \ ~ "~ ~r O Q~ y-ccY•::ll ze-4 ) /r-tv-Aka 'l: 'r ~\"tt)


~'h ~,.\, ("1 l 'h,1~ ~w \JJ ,, t

w-cl. el~'-'E- 1.d l \

i~ (~ 1" ~ 'V~c,y. -=-~ - 1")

~~ \" &np~ ~ e..e',') .i


1
' .K l~ ( ~ : : SI t e )
'\-..k- : i):,
~Ix ~ C
~ ' ; : •\'1 ~

Uc..
\ (ii

------

You might also like