0% found this document useful (0 votes)
91 views205 pages

DSA Complete Notes

Uploaded by

sigena7189
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
0% found this document useful (0 votes)
91 views205 pages

DSA Complete Notes

Uploaded by

sigena7189
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
Cechure - 4 Dntroductron to preening : Uv 'Q000 years O90, @) | Human gar Human? —S/22p , Human AS Bany bany S SS Repeot || "mee peopte _choes not Know Counting because Ct thot time Courting i Dot Aistaverable | | Gut hey aloo tious Bo urvival. j V4 man have: 5 grata, ©0 Sn RAR Rn He Cétunt dhe number _& gnats hy pring _ I & _.ctone. fa One goat = : 5 Jal he 40 fo field iwi Goa he fitted hi: Pocice+ Iti th fon ex. foc. one feat One Stone when he Comes home “he | Harow _Sfnne from pocket _lale crs hal Coker one Stone _ 4B, At laot if & @ Not Ony ste then 002 joak Ole. fe af Stone Ore hept in packet means fil Qenima] __Con eat the pak kota rm = aeerd ef eee femme Teacher's Signeture ——————— — After: Many _ye ars Gunding stem Comes The fist Guntin System js clecimal _ number- {iCseseepeescn it 5 ci Ceara a) af peter hove 5000 _Jook, fen he can Cavity Count fae _9na” and lve not need feb Carry Any Son Ou distovered by Aryab bade Vv At 1800, peopl farted +o cling bussiness and Maintain a {n9 book Of. Sales or impos = Export. let, A. businessman mainiun 4 op book rs tmpost - Export _cletauls. Now, he wont 4o Caleook total profit [fost et g Busines [o9 Book iP 10.00 payed Now he stared Gal lading Thee is a high _ probabihi: Mase _Misfaxes ushle Calculating. Teacher's Signature... = Then, Charles Babboye Moures ae Catled as Mechanical Computer (Nthicth ont: Calcutade . Looks [Ke I 210 si very bi, 6 ie ize ts 4 big 6 ) Be fs adgust iv A roomy. (TS es Ne EFS ee = Sat Css woZ Aw Some year, We found ronaistor. At present Computer ca only understand binary. \onguage 5 0 or 4. ° A a 40 das »1oco Aor Beato) H)o}ulclujr |r lo VU islets auaes Tho 11 0] 5 Convert! ints “Detinat V¥e + OS 4 Ke 41 KZ HOR th (& +. 0. 4+ 4 459 0) 22 (vecimas) Teacher's Signature... Deana td binary ie | Say | yo eae rem Ale Sto 4% ieee Ss 25 See ees o[ta — 1 AN Ja zl 4 —o Pelee =) i Blew — 0 | when 0 Come <4 0 sil | We Stop j fs 2 10001) Tronsistor 3 Before “Tronsistor —> Computer USe decimag Number System Rei Tronsistor 3 Computer use binary Number System . ONE ae os OFF > 0 Vronsistor Teacher's Signature... = i \ We ean fin 1b Number EE 9 iQ one place. | | | | 99 this We Can Fine Ko Ee = N00 Number. z seinors E as 2 See con fn daw agpes iA one — place = ( | 57 Oo W's se icone ties = a O20 AWPSe 9 \ E ere D E ee | : | ‘ \z se SO / Ri meer ans “This one box a in k is one transistor, | & Moore tes. shor" toe every Ci Wwe Pfedict Ais if \Qseé—-54 , And WN oow (he (oneapiniler: : 3 Teach: > Daifiony oe GC Ses 9 Values Apa 2 year, WeNow, M Stores 4 Volue. Copacity of dransister 1s _\nereaned Very much. Compu con only understand Binary lonquare At 1960-0 pfoyrammer CON we Code. only 10 eS Binosy form A wWeiting Code in Binary fon js very Complen While _“Winiting “Code io Binary Peon fs) there is a high probability Of mistake So, it des No} ave Correct Soluding. person 4 peso S Tey con AON Knows directly z Knows English fo spinal Z | “Tronstador | 7 1 Knows ed hindi A English both: TTronsiator Can translate the _languoye, inte Foon language of Both _ person. Teacher's Signature. ssn : |_ Some in Comparer woetd s Dopur <— Bing | Translotee| 7 ae a | Converted ep t V ESS s ——— Ovapub Converted =o Assem ace wie [she Knows. only Knows Bindty language Assembly Vangucge Assembly \009 ¢ App 2 3 Computer does Oot understand ASSEMbly language. So, _Q_ ‘fanslotoe fanslote tne Assemtl Code inte Binary Code. Assembler can invert Assembly Code to Binary Code and ree versa. Do Assemby Lonquoge Tne lengths of Code ys Very high: : TW feduce “ne lenyr of Code We inderoduce high level lonquare- es — 1 : Foo, cas T 5 similar +o english. High \evel lanquage is! _PergrommerPriendty EE Eee Teacher's Signature eS Binary Code ¢@—=———_ nyt | San z (apse 5 aE ox {Consent ta ae level t (eat Pz SOS kaew Er gh Jeve\ fang. Moclrin Assemt\ High level Ge lanquoge \aaqwoye Janyuaye. Execution time find sum of da 24 S+u+ ~~ + too 34 Approach & as24 5 44r - -- + 100 eed aioe oie eo Aut = 5050 Qy sexes More ime to Solve” and 4axe move Space Approach s Peover Pest © Qakurad umber: A (y+) = |p6 «109 x oe = 5050 Tr saxe Very \eos ime Ond Very \ess Pace Teacher's Signature. ue Time Complexity 2 “Teiel ime token by tne Q\gorthey With €espect Nor input aize. Howchart aA Au09 rom Anos Sows =the Connection b/w AiPRrent stage Sh process Se Separts son Syste. Components of — Powchart. ae we Stoc / end / IL Poput output {aa | Dfocess T aera) + Descision > ¥ Maieng ¢ era f Siow [ direction Teacher's Signature... Example - | Decde You have +o Qo out br Avot , sh it fs a Rainy Seoson: = of Cosning hen Sray at home => 9P net raining, nen 90 for twat Corte it Qa i ae fe op af ey Example - & Adi 2 number > Take input 0f due umber ___+ 2) Sum bot Number 1 2 Keturo / show the resurt. Gtart) 4 ae [A= xy Pont va" Toaghogs Signatur Erample -5 2 You ot an _ offerletter from X Gmpany. fou Wrtr Accept offer only bhen package cs Greater thon foLpA- Start) = Po Yepay es L Jee ke pe | ear Example =6 Chey number is Even oF Ode @nput Number DP number 2 ts 0, Hen even of number f-2 js 41, then Ode Ljtyjy jl end per= nunbers/a} | | SS Teachers Signature... Example - + Sum of 9 natwol umber > Take input > Taye 4 by 4° number fom a > Add the Number in sum. > Repeat +hés Process unhl A reached. = Read Number / Sum = 0 Nuw= IC a 5) Example 2 Print 0 Nadural Number ! : a Read number ieee — Nome end No sti YY poo Sun] Teachers Signature ded by tuo ou Oa = ON ed tk Cuce a Ppa =a check C e > number * > “Toke input 1. So OKI OD SER a Chex nf Initial == © = ©, Anen Prot Nob Prime . Ceturn. ese pane ae > mito 44) Teacher's Signature, a ecru eens Dntroducton _to C++ and _lalerte fisst Code | Computer Memory units 2 Smayest unrt of Memory 2 4 bt (2 sronsister can represent 4 bit) i Byte = 8 bit || Calo eve) a ke S apie (mee Bye) me = gh bye = 2 ks Caigo Byte) a we = 23° byie - = 2 me | (rere Gye) Ate eae ee Computer only tinderstand Binocy pumber. _Q_2 4. Ascil__Tagee - Every _symbel_,_Si¢n present _in_keyboar! have __— Unigue A SCiP__Value « = a A 2S GSR es FOOD C Dias ee Be 16 Ci sD OKCIOIIO) O > 48.2 ©0)10000 a> > 0110000) = E Zein heh 22y rene it MLOAl, ©) : EB | zB Teacher's Signature..... | Dotroduction fo c++ 8 C+ 1s extension of Cc lanquape - || simple cole +o _punt_o _messaze? int moun() {—> Tells from where tt start reading feturn 0; — tev end of Program: | 4 = tens where it con stop reacting Cout print output v Character oMTpur [Console Oudput & > 9nsertion operator = | #include Header file, Ubrary where Meonng — |Lusing pnomespace Std > #9 defined. int main 0) £ | Coup <<" Hello CoderArmy ” | fefurn 0} ei ~ | e: | = Of we don't ‘put’ " wsrng’ namespace std,” ot Storting then __late_ have Wik of every Stekfemeny When Ie use Cout . Std $2 Cout <<" Helo _CoderArmy" } Teacher's Signature... > Nome cy Nariat\e felnted tm yptur Codi > Nariove Name altslays Start (ait Alphabet oC tandecstare > _Noniotie _Aome Arnsic bf number, ciphatel oc tind ersfore > _Keviningd ore Att put 03 Variabie Name key incds “Whe keywords are feserved nd tne meaning Ore Sxed. asm Aeutle_ neu atch = Quits ——e\se Operator template loreak enum peyote Ani Case exiern, Peotected Avoid) Coteh Fioat Public Any char foc feqister Aypedef Clas: Friend Telurn, union Const Seto shock. tunsigned Continue ip isin A Nieual efouts. jaline, izenf Noid delede_ ind Stotic Nolatile do Jong, Stuck \inile. @_ chor Cn chane aib > Ly represent Within Single Gore by singe Value stored 9 inside. ane Quote. Size 2 4 byte. Teacher's Sighatutas..n.nuns int rain > § eae): COUN SGEOE => M_ prinis io. 4 int_mant) { int a = 10; Cine = Syais I Com aons) => pevats a | Gout << Oo; > prints to | Cour << Cc; = paints za E Fejunn oy 5 |G) float > decimal Value exe Sioot = 9-627 Soar height = 5:9; Size > 4 byte. @ Double > big dearmal value ~ Size) Sueuley exe BBY. WB2SqVRCUSS2G Ls ts can't be. Stored in float. ‘Sizes: S byte. Teacher's Signature... Cie. 104 1'S Complement (01 © ) 2'8 compremeni(or |) 2S. Compleng ert 2 Os Naas On CRs eins Ss). positive Seer ) Negottve. =for S Space (bit) rYetal_ possible > positive = 3 Negative = 4 sz eio ag Ar s2 bit Toten possible > 2°” 3) positive = _2 = 1 Sy Negative = SN “Zefo ” |e © __ boot ee bool _isPrime = true; ‘ove\ isodd) = 0) size = 4 byte é Oyen Ome crue oc false. Teacher's Sigh8tUte.n..cnsnninanns Char OSG) we toe char datatyye and — shore inieger Se___Computer Conver! _ inter Value to @inary umber G65 = 1H0000\ cwen ik ts Converted ANd « Checked iN tne ASC! table And parol cine ehayacter satiate Witt i}: {OoOoool = A tat maint) © int c= ' A => Gonverted inte Binary And Cout << ¢ < lest thao of equal to we DED Areoter AN8N oe equal to S ee Not 0) cous <<" positive”! } else if (number < 0) usp Gout <<" negative”: itive. else { a ae outi<=C) Cour << Oy “Outpud else F ( b>=0 RX b>=C) 20 Cour & bs | else | Cout << c; | feturn 0) le 9 AND © pene eOe 9 AND \ saree \e AND ae Seer: \ AND aS were aie G o OR > S SOF O oR \ sete Na \ DR d oo \ OR \ > aA Teacher's Signature... Why We IWnde _ fefurn 0 2 (ekwn 0 fens thot the program ends Now and afer fefurn 0 proyam 18 returned and. to ferminated: Iwhy "Using Namespace std' 2 [We can define the Pioperties of Keytwtorels arog “using namespace sf". fot moro C) £ Int Couf = 10; Cont Cond > > Dt ee error because i+ } Capt understand. int mora C) £ tot Cont = 10% Stott? Cond < Cont: > DP tnlork properly 3 Teacher's Signature. While a Program to Checis. Yowe) OF Consonan4 Gg eaaiciaracie ieee (i Nowe 3 a e uf Mowe! FE Character js then pant Votes Voie} OfRelan'se Print 8n_ this We _use Consonant: OES ORT oR OR operator. t oR © oR thtelede— io j Bc E etse { = Gout &" Not perfect C . i ek include > Num » Teacher's Signature... sy(ountasee sh mumcke eee) Cont <6" pecPect™ > else Cont <<" perbect Not perfect: fehura 0% 5 = | outputs pt is Perfect = _ 2 2b Not _pecfeck e = 4acing input From users cin Narroble na mes Shee chomelec input of _Canssle input > => Sxtaction Teacher's Signature... Aad two Dumber oy taking _loput from user 2 s¥ include 26. = [Evanston se Be int sum: _ Sum = Hus + Num2: Ee, Cout ¢¢ “Sum _18 un = celurn oO: Ee 2 | Loeps pe. & fumbec of time a iP) (GNI ease ces nner GOES -— j THEM ent e.. N \ines oP Code — => || Wwe Woo “tn point —_Whhrle number ftom 4 i pion: e foc__Awis__We__hove _-ts_iite inn line of Cout <¢ ay ee. Cout <¢ 25 . - Teacher's Signature EI From _ for _\nop —_lWe Coa Wwictte easily = et Re Ling t= 1, _1¢= tom ie bie er } Ceuieea pu El Code fx _ printing 1 tn_n Soe eu sHinclude > 7 i um = 0) ReGen enemy uy = Suv + es! a Coury _<¢ Sum feturyn 0} 4 Teacher's Signature. i Lecture = 4 | Foc loge + _Inthvle loop _+_pat#ern pointing A_pandit Aye OM rons ote eabesieees I Incket does not __ennal- ——G For fepeating one tntorts We use loops 2 DP Computer _is_Q ponelt then he _birite = | Pinecone ita) Court OM * d 5 ° lAinite a __ fable tusing ppeaeram. Ok Soe eo \ aT Cansta Me Z Se (aways) ot TACeMeAE SS oy 2 ae t ! RE ic ah aN ene Say j Teacher's Signature... Wife a. Progcam Et Check prime _ Number * Drime numbers diverded by 4 2 ih e1p = let check far 15 We ch check 2 te 14 ES si Ory number fm 9 “tn 14 Can divide —- 1S then {i Ant — Paine ee WS 9b Ss W575 = =0 VW (Noh Pome) Break the losp. Code ® Lo i a Rae ee eee using NAMES, Std 5 Ee int mont | Ant num 5 = cia >> num; z ee - Foc Got n=25 9 = mum ot) nas) § Ee a i Cnum YQ = = 0) § ee —— Cooert “Not prime” — brea) d = 7 Court << Prime Numbers = fetuna 0% : — Teachers Signature... e = exit fom loop pecman ently. EEStor prime - Code L {ot main C) £ int 5 Gn ns Pin <2)h Cont 6C" Not prvme "4 return 04 ase)f fic (int Aum =25 Aum <= AH1y Cort Not O perme” 5 feturn 0% cout poi ne” Teacher's Signature Ast _eiement > 6 (Rxed) lement => 4 (second ) | "Wiicel => qe 4 eine ears SO se SS eae ee Ga ae ee Kisst = 6 etnnd = \ = Current = DO 41=1 (“wird ) Nota, f= Fixvst_ << second + baa fisst = 1 fe] Second <— Current 35 second = 1 eS current = 1+ 1 =Q Chourtn), a Code 8 Se wt 5 Be cin) ay Bs int Siest = 0. e int — "Seconda =aty i = Int Current} Z | fic Cum pes; ten tra)f : | Current = Pisst + second Zz Teacher's Signature... Aue = | ficct = Second > | Second = Curfents H Bu I Cout << Current; eS 1 fetury 0+ e [4 ee — | —me upper Code Work ON 0 > Re ke r > | eige Seance € parrtibelice “Mtcep) { | eines) it feturn Cn); # ~ i a es oF i | We write = = a = elses i Ei felury (n=) + Rat * | a 39k: ballasiwes = ore | Cout )! a he t FS ed at It false a Output = 0. Ea | Teachers Si | %* || Operators (_precedancy ) Ea G perator Assocabiyib | WYSE es Left to _night: r Jel © SSS ee Right tn left OE Lasre), sizeof Es ae ieee) jePt ty Right s | Re ee | : ” » 9 Right -~n lefy- @> >i y \>\ = false Teturd 0; —=—> Teacher's Signature et Colt 2 SRT Bu vy ARR Rew | oo! Joi! [eb Bat eet waren) Rew 2 bot tu! fo tet Bal [oye Row 3 Jao | fort ford Fy el Las] Rola 4 [ao as BL : wa Fiwst A\pproach & Ne Make 4 far lnop and ia cy Pac Insp ea print id four Nees: R el for as Ue 5 Ee L Or box = 5 (4 = cot): : Jor (ih CoW= Oy FowW C45 Comsa) {| - Re Cit r= Oy cot Cay coraarh =. Gout << Y= Col} : Ss c Cout ¢¢ endl Teacher's Signaturennnssu iLCade & —}— Sin techn nel Qs yeae a -foc Lint fo= O; fw <9; towers) f Arclint c= 0, cot <= tow; cotar) [ 1 Cout NEI Cour << end) illest ma ae ele SS Mo) so20 22 ips ES eae Bo \iarS a2 3 324 & Stops When col <= tow and Prints Celta. Aye Lint ow = O;) row < 4, rows) “Be Cink Galo, cot <= row; eotar) f Court <4 Co * 45 4 T 7 Gout << endd | Teachers Signature... SDE HES Wee te se oem po 10028 930 iiss swe nein iib Wb eae bs 136 le Cc e Cs 2005) oy) 2c 23 c aa a d Zod 31d aed 33d | ast Approach $ Make _4 Yoo p one toy. ane : oF And “hin _Setand loot Qnd___incréane iA Next toop= fac Unt SSC) cence eee ee , ae Gout oO fe Cnt i= 0, seq, jae)e Gut <<" b's nd 4 aS Ro ini. (eeat\segec t qu Se nap ie pas, Ascii Value bP 9 = 99 Code foc Cine cow = 01 ity ¢ 45 fowaa) { chor _¢ = “Ol + ont; foc Cink cole 0; cal < 4) conan )S Court: EPR aE 1) a oO _b @ Woe eG arb exc vem aac 290 aib arc ard 99 6ver: Od Phnt Ny Tow Number: ee SANG TET point = of every — Cotrmn change the Value Chonges- Foc Go} w= 0; fos <4) twes) 7 eases Oi fc (Reat = col <4 Cotas )E g Gs 20s 9y Catieel ce IO 3 Cout << endts 25 Teacher's SignatUPO.cosassih Uees= 5 Patdero. (iene + While oop +. Baste Math: al » > 1 i OO OF % eu I * Oe OF OF OF 5 a i I OI, q Ey Row print ze ee # \ eo lor | oz cal ou [ps Jos eal 2 S I I fe hes ha 3 5 ea | | > ee lan [or |o2 Jos” [pn [25 oe (eal SE oe | OF | oe el (oe [oo real t go I Jae Jas [ay fas lax a Lemets fax row - sh S| J | otetal Rows ! = : Space MH = Rew) Sl int foW, Cor; — Ft Altos = 1) fo <= 9), tose) o i $c Corea 5 cotc=(- tua); eotas) § Ai 5 Gout <<" "G a Rr Ceotesy core (Re wow -1) 5 cota) f | Cour << R" 5 we i | Cont <

You might also like