0 ratings0% found this document useful (0 votes) 35 views19 pagesI P Unit-1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, 
claim it here.
Available Formats
Download as PDF or read online on Scribd
®
oe UNuT=L
TNTRODUCTION TS Fea RAMMING ©
ANP PROBLEM SOLVING,
Ls ae of Grputen:
> Cheilere Babbage CHIU -(8F) oO british ratte militian
2
sratneer,  fovente sian comee ht ot prgiana ble
co pabey called * oral {teal Engine”.
ae chocle Bableoge ta calld x et of Corepuker".
> Rekerodlic ence Galrelled Blatatoe Casce) dea:
ed cHarwarel.
| spk cooled perfern bose anithrvelic operdions ade
kon, galtiodtten , nou Leplicatron | division «
19s9-19u2:
ohn electronic. mochine akeveloped by Br -Thn tH als
i wor the wootld
Codkain nate nnatrcal Eqpen one
ack» cleati onic digits! cormputer
hays <(44S*
MeN eae stele: Gael cormpuker war the
Ls Eledi on¥
Lok mero porese electronic computer -
L>dk war developed ts Aetve voit orns neds in
gelang — \oalladtie problems.
aus 19e
Ls Electronic tec
developed tq a qe’.
alional tiene 1500 Le
LeGrittes of Gmpstes
oan electionic. device ushich can acho alicalyacae
| and xbte mpuk oka, pruan 1 and peoduce
Fe earl
AE Voriclle  autsrnalic computer OY
of scientist, Leap compsoukput eA i ATS PEO GOSS SLCC, Pray:
armed snr tons + oad
ako of Sofopulsxe:
Comnpuker Clots2- 8552
Gener,
Fark Geouction
TUred Vaccum Liber
2% Machine. leak yararain, mel
& Operckin Rpeeck oF Nilltceconde .
R Ranch Vaid yell on Seooncley
# Chctio mechanical amplew -
Ke Hove Space C10 Sougne feel).
eAn of Suxtclwa sceel:
# Melvin uscd atk bette.
Mask. DS IONWAS, NIAC, Slen
Soe :
Exteren S
Seca Genesetivn C958 2647
Pe Tangytor usd + impleroente the Sycterm
a aes Core remeny uscd af inkermal aherage.
Exaropeat TMB tgol,fcor 2950 ee,
Hid Genesctiens Case -19t9)
Me Tele were ured
% Seeni anducle ment ee or Benes aloag.,
% Wagnelic dike wee waa OR Recaincls Stoeger:
eagenplea? IMB B60 Sexies, UNIAC 9000 ct-.,
fasts Geowatian + Wes 90)
* Ta thr ayskerne NVLST Coy) Mic procenneye used.
 NOoneive yar of magner & opttaal akotage devices watt
ae move thas wo @B
 
Stompla: DBM Pe, Pentium Pc, Ae,OER Generation » Cag TU) eget i
¥In thie apreration Hablg stttiguated ic oe
ested.
€ AE will roake computer Btellige st ancl Kovuleclae
raced  Ayskerne.
Basic Orgarizalion fa Ca pelee
> Com puker hag primorl const of three cle.
(© Pape Device ® i @ Ookput ani
L> CPO Coentioh Rocesting Unie) consti of
DO pu“ @wemey uae O Gatiol voit:
> Geta (on Entrudctions aye entered thru there
inpuk devices » Such af Keyboard, House, Scanner
Ls Outpt prvides ofker Spetific inpuk dete procasi
ee aes . d
— Hence tk connedtc the computer with the Caldmmal:
En Viroament> ,
a Panter, Speaker een
Neco [Hes Unik:
> Memo oa arte used +s AGe the labs con Taaiuction
ty eearke the. perticulan sharks.
yee of enemas
Esco qremaet ion atorcge fe used bey the computer
to cadttruounly veack and Suetike pigs
Surudtona Z
ESS weeds “ocd scaler Lae earls iM ale
Are tn Khe econ clay atorage et computer:
Se RAM, Rom.
*
*
**&
Secon car Seca . &)
> Secon ay Beers elven ts ae yolabe! data loa!
which Ya onl acceacible Via primary Arora ce vices
empuk, oukpak anberfacer «
ra k, optical and Aborage davies.
a
usin
Sg Hert diac, Floppy el
cp, DVO ate,
Gertal prscesing votk (cred:
pe Bey cpu Raps two basic pale, contiol unit and
Arto lege rele
> When the prgian coo be. éncedGd | ord cantied out
reulay telat
tne snetructrons aM
, Gatral Unik ae a enpertank unit drat divech te
opevarion of the proceaners ACU AG picall usen &
ened clecodey te cBnvede coed inst Lickiong ate
Aionin. one contra Si lar
Artingetic lagi: Unik cause
I> he amnpukey sore” Aato, ALU if used t do all the
ocithrnnic ope rakers pach of addition, Aabliadion ,
division « Vagicol operations oleo
roulkiplicakisn = 0m
bide ty he, ALU.
> the smpate Ar an ALU ove the eh A be operated
da” ‘
1alionf? z
I> Accurnulator, ingtradion bee architecdave _zrack, meeginter
pack, Reg prey et :
ALU. CON &
»| Pratan Counkers
oe p alas Known on Satvuction poinker thot Ktspa te
adArean of the newt toatiadiinn to be_
 
of the re
e  (Prararne
ages®)
Totteductinn Le Prasroming lenpuagerCoh |G)
5 Gk —lenquage) ip be Tmniddle level, Rech Libr
gakencill, Hrecuy ator) > peinkew , fasler, mem oy) rremogt
on
Lo olonguoge TAO bidard approach and sich ack &
libro “Cuncliong onc cate types.
EST came be evento witk tears machines sthrevetore
cKwa machine Re, indent a :
p? Ooo ilodion and ae Be Ne lea,
ae Provicles the Rakares of pointer ce ciedly
trkerack uth the money toy using the pointes,
Ly We con call th fandton Feaitiin fre®!  el Aloothn wrkten Gngivh then tha “called
* Preucte Code’:
LeAs
opie hae one. (en mete input ond. eutputs
L> Nopithm cou Lewrninati MH a countable no of Step
re akep of an a dm rouge Baked ¢ ;
Lstcach step easily convertoble iste Prayem Acterteabs
Examples Waite algorthno fox ~Fnding Re oxernae of 3nok.
skp te Stok the Prayer
Shep 2! Read 3 number arbre
Stee32 Gro puke js see are 8 He
shep uz Compulz averouge> SvlB
Step se Pant average valuePR] Flow chat Ong Ce Teal ® 6
[ows chat tx nating but a gra real “wveprescenkatten
9 qe P
tana :
L>Tk tA used Cov cheov underastan dan, concer
Ls ote rake. kepting and chhugang will teame cosy.
Praon Ae akepe M1 an algorithm:
Syabbol | Name | Deaergpttan
me) stout { ead ITB repeat shock Coy) End paints
—— | Arrouyr One ts anclher bled directory
ee Papa [ookpuk Preallelogrann AG wepreaent wmpullelr
pee Process Repreene Procean
S De claim wincliealsn Aecigton pure ee ate
x Preado Codes
b> Preude eh tare Arnple ey ts vrepecent on olyeit
en pio ,
by chads “Hells wold” Pp am,
Etom ple peqe™ with ape CEnkearaled Develops 5
Environment).
thinclude zstdio she ras
Void main()
te
print (Hello wooild")5
sctum 0}
ieDaotocclteo te Gmpilation and Exeulint ©
tude Lt & a.00% ‘ i
0) Pre prresarer @ Veale: fle a Fanclions & Vertablya
@shobemente & Eaprean wer = @ Grome ns. :
1 Pre- Ruoseaes? otf imclade: < 3
Lb Pree Yor epaor Corareand.
st ae link
 
LAD’ inittclige te Environment
the preqen ete te heoder les oe equine
D Leader Gece dude estdic-h>
TG ees arincade < Conroe: h>
skdio-ho clench. input oukpu header le.
Onin: ho Gmeole mpul output header rile. !
Bydaingd Loclint tak maine) hear
ES Chen! Clopenrem,s dennis
Bo eat ee tates
Zak main) —> thir —finction can rekum Enkeger value,
Noid pnatne) > The funckion. cagnok) wrekuen| a. volue-
Le * Bente ite the oukpat —fanclton . :
ot Soothe | ee the? tpat SGikcten.
s|C Poararn Sacebions
Stept: Open -tutbe c.
skkp ot Open Cle Veo comdce te toat a
hep 3tteindlude  oO
thy Zconiohy
Void mamt)
 
Prin Co rng name 4 C");
 
skep ut ch « es
° click on como 0 prepa “ALLL Fa",@) step 53. Click on © Run" @7), Reap “Cle Fa":
Outpt: My rame eG,
SC. language Eleroenkes
bs Re pre cena a srindude estdioh>
b> anckions —> roan) -
> Vowialles —> Datatype variable’ —name; ink oa float a,
> Shake mente > Switch, else, f else Pov poh, ars de,
L-> Gromer —>-fox Pegqram non Sachin atakersen
ear Rererved toords > voids. ‘
Exe TadnkGer none ey Vat tables.
—> character Sek Lower io Upper cane Digi,
kpeciol bls -
+| cote c
LO Primikive Peta “ft Sekt chat, Pleat jioteks
a Devived Dota pes —fovr akin fe Rone. pownkers,
(@) User Defined Data type = Shuddien, union Hareb
enuro,
xeParili, Dela typus
1? Aatthrnaltc tape Gaihe a0, Sane short
Lather claaritte d ants Una. ‘ged thot
ankeqee omd | ae fe ante
types:
Unat
Void zthe cla a,
Void 4G pez the cata hax soe
no Valuer Co operaor Aare bong ¥
and % doeanst pr shee Hak
ovide QQ vegull ae gels
te call. nepal A
Signed data type reane ik Deccan paaitive er@PVocignest aka ees: takes oly positive velluc @)
s at tay -8 bits pa nee
‘Dertved CMa -hjpes
b> The clata lypes ac clerived fern the pyrite
Co) loult ty clta type ac werred +o af
devied Aako type.
3- User clefined ctaketgs 9
>The. ake byper are ra ued te aacign marnep ts
coke gual conttant which Yrnoke a pre cary >
apead:
|Vasiclle ond Cneladkse:
I> congkank an uscd +o he \dthe Rud Valuer hic
we con veltieve later
L>A Variabl i used be be
be cha aceon 45 cthe sca cysivern a nV
Conic Sopk ond. og
sages ond. Spek ttokemenls:
oukpuk Akakerne nit@ "Oute. ured As wad &
 
\ouk cannot change.
\d worne Value tkal-can
%
> Dopuk and
vote the Stk a Cee anton:
Lotsbes Sopuk - output acheds
“ e orl )
I>dk wv wad
Rov aad a ging char font
tom Go  Ek ih used ts Maplay a Sila cer on ene
| Syntaat pucchartyy, cham’ cha, Ks put chan)?[&, ks 23 . @
tog! te uced te rad o ating fom tk, Kean’ gi
‘ char n(20) 5 ges (nm);
SY paks¢ 2
sch ie used to displ oO ating on Acieen.
pakke ( bext bpe’ a4
Frode d Tomsk oukput furslions:
Scan fy: Tk 7% used te Yead the mind ‘pe of chte:
Bom the bool.
Synkoas Scan C* Contiol Skiing *, og are, te oo ATG;
> Pouenent sreprenene user defonred Vortables, thexe
werent adden of the postteulon” ‘Variables .
Seank (ty. Aydt", §a, ie 40;
Pink! Te tA aecd to cov the oukpule data forthe
Core pukes nen
Symko: prin oY otal aking on ales ange);
+ | Operakoras
‘| Aaitimelic, opystewi
Opexakor De ccaiption ee
+ adabion atb
= Sublvackion ob
Halkitcaksn — at
diviaion alb
rredule divaion oY. b-
Etonncles ee astdioh?
inl rain C7
t
N *
ink aib;
art20, b=3,
Prof’ the value of azrad,"a);
Prikl C the value of be 7d," b);pin AAdilion erel", catty); @
Prine FC Subliackon= ZA", Co—b));
prok LO pabkipheabton 1A", Cor #b))5
Proll C OWiciod = Hel", Cab);
PHOEC CC Remainders 7", Carb);
ackuin 0,
ss
oukpals D0 32 2% It 60 6
2
al Relakonal Operators?
Ss Wreee are called — Gommpasiaion opereloys (Bing opercton
Opradors — De scsiplion Rapeeserdatton oo
< (eee Ahan
ach
7 Greakes Whan orb
<= leaa than © Gute ac=b
ye
Greake than oi) Sualte a> if
O==
Equal.
Neck Speak ath
Sxacople: dhindude b);
prick Cro leap than ov ejuak febend'sacot
printf Ca greater than o Ejucck ts bend" ar=b
wow
-
 
pial (oie equate betd',Ca= =b);peté (va te mst Sualts bera", cat=ey; ®
|
| ackimn 0:
Operator?
3
Ne ave uscd tt tent “tw @v more concttisne
tk vetume 4 oF © (uc ov flee.
Operabey Descvt on Example
$4 logical AND ageb
uN hogvalor al\b
iy jogical NoT La
Lxorople: tt include” 
Fok maine )
z
ih aibs C5
Qz20, b=15, C= Bo,
epaolf C'the value of azy.dsa);
printf C value of baud , ord", by 09;
Gots Barc)
paotfC" a tf big")
elee
7£ (b>)
pant ("e fe big’)>
ele
print (Crema big’),Oh
ssignmok Opssobowss
Sypkox:
Variable
wk abc;
Q=oo',
lp=0
—> aasign
Value Cor) Expreanion.
variable
cz Oth > aeRgn Exprercion
ar=b 4 azarth
a-=b 3 a-a-b
aezrb > azarb
avs l > azatb
al=b 3 azalb
Bkusse Opetatores
 
 
 
peteinelusle
Oe
20;
nth (Value of o>”
pans Cale of B any
puirklCNARESP ord
pack (subi ocien pat"10-=b)
print Cpwistse=7d%a ry)
pasts (" Reminds 1-4", aeD}
in 0
  
 
 
5
V]@ Baise cproplernenk(o!
=> a= Coto),
~az Cotol), = 5
ANol$):
 
= a=(trolo),
°
=> b =Ci00),_
°
lolO0 F1100
aeb= lO
L600
oe
tooo
hea
agb=s
| viene ace uaed +t Single BL operations,
Operckor [Genes pioo
ay Bikuice complement | a= (10)
& Bikuice AND a
4 Bikwise o8 B Bitistse
nN Bikwise KOR o =U),
xe Bikiacce left Ane ren
> Bhaice vighk shiftc
O&be=
fo sites oth?
a - 2 to1o
asto , b=I2 , Aib= Mio
a
LUO =ly
ID Bivins S008
actO, bri2, ANB= (910
ttoo
 
Oorlo=agWOR
Aatee gE Cpeetout®
ee Nek aL ee Carly ave ahiflecd te LeQ)
| > Wyk ate ee Crk ave alle d Ge (igh)
Ragunplestt Relack. 72):
eet “
y
5
Gadiional Qessle:
Sqnbeart Vorable = Sapte Exp 2;
€ap3;
Gip-\ ig Bue then Expo enced
5 «flee Chen Eap3 Saco
dkmdude 
@k main )
+
ink abc 7
Qz5 brl0,
prank fU'a@s rd beva" arb)’,
C=at+) + Cbtt)
Pinel ("ce7.d",0)
3
Ookpuki = SHOUS
Neke: ah ca C440) +C+ 4b)
Co =6, ben) = 6telt
“f cole -a)4(--b)
= Ut4=I3
Cozy, b=)
ca (a--) 4Ubtt)
Cz Stl sy Co =u) b=).| Cao roples wwdude  ®
thinclude 
mainc )
t
mk a, 24m c1O,y 220%
Zz Faeyr y
Q= aR
prainkl (Sd A", 2:00)
4
Oubput= Z = Ulo)0)= 200
QO =(10)() = 20
Nokes oz = TxD ACOH 21) — HO
Gz gy =(to)c21) = 210
x Tyee Goyersivoan d caeking:,
b> Conve rtin one type ok cola ats othe tg ‘ype of coky.
Dangle ype Conversion: (Autoredtic. conversion).
ees eigen toy He compiles woithiut tse interventions
pormeet -
Lol piece estdioh>
ink main ( )
z
wk n= too,
chav c= to",
flat Sum,
Sum =nte j
prnk£ C'Sum =y.£", Sum);
iy
Oukput 2 194.0.@) Werplct bye Conversion: e
>This ‘gp of conversion TA pxifemacd by the porpemmes
| Synkoa: Cdaba type ) comae Expre £480}
ae (%k) B1U25 AB
wk oO Float a
a= 2/3 a = float (221 6)
oa+3 Q =3-333-
Exo onplet dkinclude 
yak roan )
&
flat ay
as (float) 22/65
1 parkl ("7 "5 0;
actarn 07
3 -
3 i : dkmic 2 ach
x] LeWucn Saving Edmiquec Algextisnis. eppwech
> Ppblero Solving te a actenklic Leclntqueto discony
and troplerne dt the answer te 0 Iola.
Lsthe cornputer A & agrobool roan pulokerg device that Rls
Be «et of commands Known ag * are
Ls Qogrann te the set ‘of tostiudtons’ uhith ts vvon ly the
congoster ts perforns Apecie bask.
Ly teve ave some asic Atcpr te zolve the problrns.
steps Tdertify and Dene poble
Skep2% Qenesate poacible ackubiana
skeps2 Eolucti Aberndives
Skepus Deade a solution
steps? Penplement Solubion
Step et Evalushk the vecul>@|
*%
%
l silly ® chovackeristico Algol: * @
I_Sploortthen ts tHe sek of ovules hak deve how port
teclay problem can be golved wm Gate number of
eps -
eed
VVEnpot = Spe cy and require input
@.Oukput 8 Sslukton Ff any Problkm.
3-Deknite z Sclubion rouct be dleasly ARred.
a. Effective
5. File # chepy musk be Raikes.
6 Coneck 3 Coneck oukpat rusk be, gerne
Poblkim- Selving Strakeciess
Top - deseo approach:
Tk an approach Ae derign aleodthm tn which ob
piokrs te broken clown ants srmaller paste Cor tie
the peblern).
I—> Tk use, ecornpoxitton appeach . ,
> The approach t« generally uccd ky atiuctired programy
hon er duch ag 6 CoBol dle,
> thir” approach box Tedundaney occur.
> Plakfown laced tech
tk tn uced wortk clewmentation of medal & dbgeing
Code,
Covere sip Agprachs
[> thin opprooch i¢ used te sole Annaler poblime, then
delved problena ave inkegittd to yd the Aslation te
oO  beger problem .
ok algertimn must have ~Bllawsing chorackestatix
rock uses corn position approach.
tke generally uscdin object onented pegs Auchas crane, pithAbvwale ercapulalisy and cota bicbng scTayacaeapereseal
to Asie appwadd:
Te ia uae Lelia nodules
 
comnplestilig of \ orilhrnes
nn tf Aaid to be Effeienk
Pea Ramance Analyeie — Ain aloorthin
& faek wth Lakes lear Nitne ts Enecuke. Ee Conaunned
dees Scop anal
Space Complexity gh ve the amount of mmerneny space
requived by an algpritin cuing the course OF
ankeraclion:
oe Compleaily — ob rocans how
create the at)
ITnetiuction Space - Th te the space reqs
Pro9) YAMA + .
peda Spee Space required tts shore lala CVeriabless cone lant
Conctagt APA ce conoplenite ag
thi« pe rrequcxed Rud eae Ine Sqnore Cn a)
ee apace ~Pox all impel t sretuemn axay
Values . i
Laneay Space Com Jeaitye
Linea SPA ce ERE og ent Bum Cint ACT ink n)
Se variable tna wid “Gs
ame and S
ARK
 
much Lime tk conse rred te
ved fy th Enecalet
Amoun
spk Sum =07;
an value =n words
“A of value 4 Por C=0,1<0 544)
oo vontable ed wot t :
Sums Sum4 ati) j
Sum voriable =1 word xekura Sum;
3
Outpuble (+9 F1t12(H 4B) word .
 
— +» — =