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

Dada types

inse Sanity e datu


Name Can only be alphaC
Man K's
nu meu
e

0eoleam

swe false
opeaien : AND, oDR

Res ult
pe Boolean

Tntegen
C -3, -2, -1,0, 1,
2,3,)
Openaien + X
mbahisior),>,<
Res lt
irdeqeh
Boolean (in case Combanisle
q

HRe uKyen diuisien


ot fa cte), EKe 2
Soch Case, eihen Say not aWoused,

ake em emirdelT
quotient fomqet
Chdhacte
Values al phanumeic
z
A B.. 2 ab.
O
.9
Sheciall chahact ens

Chenadien
lemparusen p egpivaly)

Lesult ype Boalean


Subes
ntae
Dat es
Range 0,,2, 365

punt (O)= Oadevalue *1 San'

Aind (3) - 1 Feb'

Openaion pnt
,> =
Compoisien

ManKs

Kange ovalues 01, 2, 3.- - loo


penaien
Result
e ManKs
Boolean

ut ho
o 4-S Xloo =445o
oabot q4.5 ManK

No a vald Vand rouo


dobaype
places
Fleat any no
decima

Quality
Anoort/
kange e values O,1,2, 3...
sting
openaien Snd
CQuamit
4,> (Sooleam )

Resut hy bes

store 125 C 2S x l00 12S


e pont (12s)
-25
Compley data types (Recehd List
alSo called siut o tuple)
ORecond.

Dada +yþe oih multble ields


-each e{ which has a name La value

Fone Name oeld. Type ield


Seayence no. Sea No
ManKs Cahd name Name
Gerden Cheden

0oB Dates

Mahs manks Manks

Oada ty bes
Seeikcten

CT7
T
Sequerce of dole. elements
Ca esegpence ehecnds)

Neme oield. Type of fteld


Shoping Bitl
(Pecoen) Sequerce No. Seq ND
Gdene Name
Custome Nane
T+ens TtemList
Total b0 Amou.

THen iist Nome o 6eldl Tpe


LST)
keld
Ltem Name Name
Item Categoy Sung
uality uality
Unt phice Amoont
Cost Ampunt
Conditienal tenminatbh Tn tesationn
, in midale of nemo-
Hoo o tehmi nce ideatiom

whadeve we ahe checking


=
Founo False

NO
/Moe caid in Vile STof

vot (ourd Cad is Found.


not geond-False)

cad is stillYGS
rotgond
hen yes

YES Foun0 Dwe


Cohect Eo =

Cand7

NO

-wl check oi 1* Cand & exit.


Local opehašiens&Ma n snge it etation

Cx Checking
ChecKing Max total maiks in Soe Cad
(toppens MahKs

Steps
O ho hhough allhe Cahds (iteoien)
Save Aax total.yahiables =0 iritilipster)
InUhame.vtasl
updoe. Vahlo.bke. Max with Max total
Value Manks

Replace Next
Max scoNEN
H
Value
e
(ManKs) Max vauable
we Cam have Multi ple Vaiable (count)
in Single itenatiom

Max ustome
Ke ining Shop with
finddn
6ilings

Shopnames

Max
SS s2. Bil
T 2 3h S Jabiable

Tnacking 3 Vasiables = B, sS, T


(shops name,

1 vahiaMe Max biQ


(Bon 6ttl con)
Aoss
esing
oithout
ileation oiho
Max in
in asingle
e theg Count.
ino applicaion

easlien Max itenatien


MaX itenatiem
hoblem toith

-Only Max Cour oas Steed hecordel

LiKe Max SouhcesB fO Students


but net student rame Cand IO
Yumb

7
Hou 2 Solve his

Have 2 vaniables in each iteaien (Singlee)

Max SownceS . 66.. . 9+

Max Lo Cand é y 23

Note ome hme we may need Multiple


itenaiem
tlou Chats Max maks
Tieosion itf eina
Geneic flow

Sta

Ini jal3e
Vasiable = O

Mose c ahcdS m END


Pie 1

VicKa candX
om ile 1
Move x to Pide 2
Do Somehing
Check fo
6 NO

|Do some *hing


n yes
matKs
Max eMaths o Cahd also
Keep toacK

to shouw Yaiable
START
Vawe is NuLied
1D = -|
Max O, Max Cahd

Mene Cad NO
END
in Ple 1
YES
Amet

icK &Move X 1we have sudens


oith Max Manks
Ho Pide 2
her

NO
Cand X.Maths 2 Max Cahd X. Mahs =Max

Yes
CacX. Maths Appe nd Cand X.id
Max =

AD max Card idL


Max Cand id = Cad X. id
Pseudocodes

Textual ephesentation o lou chant (alqos.)

Vahiable (O
VaJriable (
to
Valne fo
Value
Stant ASSining
ASSiin
Ont=
Count o = O

has mahe Cands)


ohilePile 1

Conditional PicK a cahd X hom Pile |


ExECUTIGAJ
Rebeated
Move to þile L Execwtien
Inoiement Count

End

.
itehaHen oith tes
seudo Code e
SUM oBoys Mahks Maths

Sum = 0
I
kas maie caicls)
Lohile Pile
icK a Cad X fei le
Move X to Pile 2

(X.Gerden = M)
SUM SuM + X.maths

ASsiNGMENT Stajemerd

Count = O
SuM SuM X.maths

LaN)I710ANAL Exeti@n
once (onalition) {3 else .
Reopeoder
4Dhife (Lorditien)
.t
CSsigment C-)
hocedwAe
o Sum e MaRs on boy ginls

hoce dune Name

fanameten Gem n Genden M/¢)

Pno cecure SumMaths (gen)

SLm=O
while Pilei has meie Cards)
Pick a cad X hem Pile l

Move X D Pile 2

(x gende = gem)
Sum Sum +X.Matts

heton (sum)
erd SumMahKs
Calling a bhoceduhe
eg Maths
ias Sun Maths (F)
Manks
SUNM

hoceduhe may net hetusnn a value,

foe we wandt te cethect maks ehIsubject


Ona Cane.

hocede Updade Man Ks (Cord i0, Ssubjed, Mask

SUM = OD

noceduae
Called as a Pdade Manks(1,Ausks,88)
Stpasade
Staememt
ins Phy Som = Som Maski hy
Pseudocode he ToP thvee Masks (Subjed)

sececnn€. Te Thee Maxks (Subj)

max O

Second max = O
Thisdmax = O

ohie Pilel has mohe Cahds)

Pick a cad x om filel


{
Cx. Sobj>Max)
Hhnd max =Selord max
Secondmax = max
max X. Sub

4 max X. Svbj > seerdmox) {


thisdmax = Setondmax
Secondmox = X. Sub

(second max> X Subj > hhdmor) {


hihdmax X.Sbj

aetuhn hiad max)


End Tof ThaeeManKs
1teaionn bing
bin he.
he
Connept ol neStal
bithday paadox
(Using 6innin)

neatng Small Categeies e


6ins

ke,
we Lot ho Collect studens oikn same BO8.

we can Cieade ins


Sins en each mont
(caegey

then we cam go thioh each 6ins o see


Students Loih Same Date.

his oay is faste.A easie.

educing nomben e (ompiso


Compa9ing each elementS ith all othes
elemend

Suppas hene ae N objeh

o. Compaisiert N N-1)
2

Keduction in combaisien due to binning

foct e eductien N-
Mg-1

N N0. ob)eH = 9

K No. bins

9-1
s)- 31

in his Cake

heduction is by facdo o H imes,

You might also like