0% found this document useful (0 votes)
2 views

NOTES - 20Sept24 - Introduction to Programming

The document discusses the fundamentals of data structures and algorithms using Java, emphasizing the importance of communication with computers through programming languages. It covers concepts such as machine code, logic gates, and the role of transistors in computing, as well as the process of writing algorithms and pseudocode. Additionally, it highlights the significance of high-level languages (HLL) for human readability and the translation of these languages into machine-understandable instructions.

Uploaded by

ysanjaysahu0035
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

NOTES - 20Sept24 - Introduction to Programming

The document discusses the fundamentals of data structures and algorithms using Java, emphasizing the importance of communication with computers through programming languages. It covers concepts such as machine code, logic gates, and the role of transistors in computing, as well as the process of writing algorithms and pseudocode. Additionally, it highlights the significance of high-level languages (HLL) for human readability and the translation of these languages into machine-understandable instructions.

Uploaded by

ysanjaysahu0035
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

DSA with Jave

we Commyrick thuyh agye


or any otheu Rangye
"Give me thad Book"?
me one

So we need a to Cohmyicat,
we wan to CommyNcat eith ou
we cawt use itnguyes ake tind' or
phone,
-A We need
(c,Ctt, Java, Gthon, vauet
Cs BoL, Obechve -C, PH?, , fel, Rust, Go, Susilt, ksal,
Scala &tc.)
GmpaBe is basiall an elechone decice wkich undestenos
O, & s.

angynpute
And ue wat ou Aapplcompueallionydo onangy huk for
ttions of instruc
ons
fut Ohdto cahmkeexetue ke iil-nd poobony
some sothoes to solve
6conds. nt
But fust let stat wnith simple tesk.
add tuo nunbeus 1 74+ 65

So how will we ask Conpute to oo thiy fask ?


Do need Conved 14t6S int biny & then geit to
Compude ? You csn do so but 4 ht tht dimple.
L? we wnt to wute a wjom in nchine Rarjue(od)
cade|pmg
Hhen fuut weoe heed to Undeynd he CPU ucitecue becaue
cu has heu oun
mackine Code ls fotes ns -apeif, DendCintel, ARM, A)
tstauchan Seb.
& then leen the istucte Set & Hen dohvet the
instchon to
So inskuctiy
înucdors Pgom.
is a instauchons in a
Hat we e oompete pefam
nnpute necds
Unoeutands enly O, &1s?
otrtes
haveoy 2
halwae
bocaose
ondayi
At te mest fundamenel level esmputou
electone Cormponerd like tons dos
a sdates on/"f & thi onf
TrasistorA CGn be in
stte be represental
blocks a mo den eleetoie
Trangistors aue the basc buuldig
memoy chip
phones tompute memony
( dm ad olevites,
Lupbp, dmat othee applie'>n)
Ca

A toensistor can act as

ENI9cC Electone Nlamejal And Coimpu) u the


Pale electoc
omple ked in 1945. ing eleetovc
Omputeu besiely putes infomatan orN)
buarteheg knoun os, whch on be ithe
tgn O&4 thott
off (o).
ideel for computes becAvse Can be esily
epresented uing elechoe suartehes
’ha Gompeu ench hansishe cn be Hogit
ueiteh tet can be eitie ON(1) OfF(o). hese kaastehe
besc eompone
ae combined to form lgre ate, wch
digitl cirutu. Logic qtes peform sp tors uch
o to proces infar ma ton
AND, O and NÛJ ch oh aue yed
Uhed to
bild computay that se othe
T}% techically peaible t but
such as decimal hexdeumal Lt
beeawe:
pafct chate
choce

Gn beleaiged wsig sim


electome ue moe
Decmal or hexadeumal cwould sata
repreent multple
Camplex cyxurl topretnd
49me 9 mount
and mooe suitcha to huere Hhe aiee &

Conmpdan od computes,
powe txtnted to praent
Scalhbi.ty- Aarh esily be Thia is becaune binay
Iago amount infon foen lepey wnrl
Canbe esily onbined to
4uch as
a ondvesal Rarye hat Can
canpudeu igadlex f
be ondoohod by all mgnafchue.
hew auchectup or
is foa (4auehy ) în Compua lap
Theue aue billio af tans dusitehes epregh th oleta and
when ombined Hese ono oley fesk & aloud hong.
instuchons for how to Complele
complek Conmpley
for humary ih
y to do some lesk in machne aode ade ln bhy
(in

0000 O000 Jol | lol| 000O


lo| o00 0000 olo|
0000
cawt wnk a0oa dato &
We
jngfh in
O|| 0000
this Code ? T dont think So,
menbe
Que So Cqn we dits & instuchony + the
in dd trnes, to neut
>&t Back hen weee
Cand,epo tape
Computeus, datehes, pnched
Wee entatal duecBy
4untehes to specife posihon, (it ee preeuye
So thiy Comes ohde Machne layeye. (drvect int? lauerel,
dufpeudl to ese)
Then AustenlMnemorçs
aie ugg werÇCame0sed A
DD, Suß
A&senble
h speeupe Hadee aelste tuue.
Clorely ed ts
level C9me.'

Haidae aucheetuue
Not ted to
Compile. |Trteuprete ete.
C, ctt, Jve, Pyton JS
Moe Readable maintei ble
Cou platfam Gmphbil
homeng to Comnuycge uoth
So alos

& solve grublem


Q

would
Evefhi 41
nombeO,1,2,2-)
Os
into
canveed --
A,s,C.
) -) Hootta)k
q C, 0
4I.
.
<oithcompueu?
be i t (a,b,
decteu
shether
chacte
speeral
a
qny

Homen olo|lov6
ask) Irnstuch n loo00|...

lhese intucons ue sutten in qny


C, cit, Jara etr) hen Comp1lea conYerl these insichony (HLL)
nto orpute Urdestndile famt and thon
Bol uhon.
Rue:-But it is
Grnpute, yoo ca't gie 4orme însth

Ans. Becauje comopue has no boeain. 4u fut, acuate, chient ad


doesil feel tuednes bul His dob, So we lave to telo

mom mangs So you go theue


ahd i yu don) shep, hen
exmle Humans have you
to othea
Can
hap.
deea de to go to othe

TBut compdea
Bhept bdn
se can
A
Commynao
Dyedl t e irt hl a coimpute an exerte. It provdee
Ciete m to
Cimpade.
Jasks,npulite dt &intesct eidh kudse.
HLL (B C+t, lythn, Java)- e kse to homan

LlL (mscline Codle, Aosembly J: clese to Conpaet


hacoae
Bane Teyns

and mantan Unes code in q


(called codle) Haa canputa
key aspects:-(Taesks) Phgom,
On

Deljy, Tah. nainhig


Chefyoot motha.
*o methee decdes alat duhes o make
bhe has aQl he ingedyent fr thet at home &
Hink obout has each cu uull Complempnt the
othes.
Then mate a plah to cook
* Then deyve

Rike
ahe chap egehblea, bol ont, foya.
maty dlogh ( wtiy speußt pats he
she mese out folleo step
by stey instosynta) do cuenk
these luhes

Algortn
definhon) qn

tea, malce q call iten in q


moat ptse
nslaucfons utten in
teps| instctionst le a thad pafuns
Prblem peeufe fesk 4ole a problem
tesk bajed

heal te Tea
example
(Reuipc)
skp1: stat
Sep>- Joun ete Imto a goucepan
Lugn the g4 on qhd pd gouepan o
TuÇn
step Ccudeto ma ) & boil. t
ad Spices ( he,
stpy:- Add
Adel ea leca ves tea powde to bol1y coe
steps..
minutes
Step 6) let it bosl fr abod 1-2
Step t- fouy mtlle to. he saucepan
He miatae to Lol agn ehg
deesnt ovefla Shr fr |- mte
Add Sugeu fo tte R
Stpt: 3 mnytey an low
fet it boil fr qboud
stplei. fame
o seiney into tups to
fes ttag
stepl: oun the feg
demove eaves & pres
Beyve hot
Hlyonthm hot opeufe to Csmpute sUence, whenu
chous n4 algoathrn
khon
-’hen You aue actully pefng heje steps to mad

Ansthe fx ample
SUm Q humbey
Sepl Shat
Shep2 Wahotat Derlaue auables non-,hom2 and Sorm
Skp3:. Teke fust inpud in
Take second put in nUm2
-Steps: CGleulik Sum by qddiy nom| & num2 4hd
SIqn Hhe esult to rug ble sum
So m hunm tnm 2.
Som
stp7.
wlat is Paeucoca de P
Rseudocode
oynbiaton o plan enyh Raye ad ad Prgammu cornsud
bndge between the alenthm qnd
and atal
Pqumny Code.
|Algenthm
Pseudocode
BEGIN
f nomb es
READ 'nom' &'hum 2
CompuTE Sum
Sum - num t hom2.
PRIpNT 'Sum'
ND
moe
dtauchued than Plein erlyh bud les fetnal
Emmple2:- Cheek huhbe y even or odl.

READ

PRINT even

fRINI odl

Cyample- ont Norbes from i to lo


SET num | SET num |

wHIL DO REPEAT
fRINT num
fRINT num
num hom +I
num = nomt
UNTI L num l0
eND WJHILE
END

ponguma inin planig te bltion t He


the pkle
NoTE Hhelos thes the the appoch to
wee0
s
the pooslem.
seade
undecshudig
poces
ch atkp in
pren (alGonhin
andaudsed
veprnted ymkol ond
affaend aymlal
Contain a dhot descuphon the
SPlohas ae Used in vaus felds kite Gmpte
bui nes prot exs, modelin Systin
key elemon

(peatlehgom)
Pooces
-

loslhes:
Gonnecor (stnall ctle) Connect
Connector)
usedl to connec clfeed put a fasthat
espeenlly cohen t purs mlhple p

Add a numbes Plowchat (BHant


Sat
Declae homl,nm
Sum veugbles
inpud num)
Gnd nom2
numy &
hum 2
Add &h
Sun:
9d nwms & um2
Sum- numlthom
Pont Surm
font Sum
ind
rchce Queshns
Que
to nombeu uotthet uJig thsd vausble.
q cyocle
Calulite aues & Cirom feence
Gven romber is even odd
Que 4! -
Greetest o Hiee honbes u fenay opeuto
Som d dyib 4a gren numbe

Ans :- al elak Area f Recteye, -


Alo ithm:
Siep|: Stat
Declae veus bley lenyth &&bread4h qnd are
Step2:
Stoe values in reLs bles leytt
seps; Tate fnpt fn se d Plowthut,
formule
Step 4: Calculae aeA koiy the
Declaue vey alles Qent
þseth & Aree
Pont ea
skepr :
bseadth
Beudode
Calclite Qei
ALeR lenthybet
READ Zeth
R$ AD Boeadh
CompuTE Area
PRINI Area
CND
2 humbeu erthot ging he veusble
Pseudoco de
Stpl : Stut BEGIN
Sep: Dc laue veugblg 4 &bb REAp a
Red value, o 4& b
seps:
Step 4:a =a+b onpUTE
b:Q-b
Step s: h= Q-b
fRINT a
step7: valuey a &b PRINT þ
Step stop
flowchant
KStat)
Declaue a &e b

bea-b

p
Ans a circle.
Alyoith Sepi inefen
perlae yausbleferaadlis a) aea and
stepy: aloy He fot ml
Stepf. Caltalak Czcoma
Cintumfea tnce by osig the formta
Crtumfuence
stepsi Dupy val4e o ares and corcomfeence.
Stept St
Plohaut Sh)
seudhcode:
Dec aue vauy ble ,
Read e uea, citemfeene
SeT pT =3-14
CompuTE uea Set Pr =344

PRINI
Ues /Red
fRINT Greo mferene
END, C)stomfeuehce=

Pont aueg
ircumferene

Hns4- Nombe s odd o eVen

Slut
SBopl: Declae q vauable hum
stp'e: Take inpd wsng tte
completedy dvable hy 2
Step: Check i? hum is
hum 2 then (ont
nombe s odd
Otheye pnn nombe
Steps:
fbuchat:
Pseudocode!
READ nom
IF nm = 0 the
PRINT even Check No
nem ==0
PRINT dd
SND 1F
END krt nrm hum

Step

st of aules tad goven tho


In a stucte o seotehces
I am techig you Java (Coorct)
Jav I 9m (Liovect)
uthe det ule f
fo sel aules hat defne the stuctue
Qnd
úete val instu chony

I4 ule, ase not folased, code wont wk

You might also like