Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
33 views
13 pages
Arrays - Class 1
Uploaded by
adapala
AI-enhanced title
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
Download
Save
Save Arrays_class 1 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
33 views
13 pages
Arrays - Class 1
Uploaded by
adapala
AI-enhanced title
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
Carousel Previous
Carousel Next
Download
Save
Save Arrays_class 1 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 13
Search
Fullscreen
classmate * ‘tg) Pate lo/O2 (2023 ss }) Axrat A_bagqage which contains only similax ty be of} -
5X4 = &ov bytes. e odues Gh aniay axe stored ak conbigueus loy U2 re [77 Memory LT TUT log M6 124 Why. Is_ownay needed ? One abblicah'en « n Mike (f we find the maximum: “This wilt fasten eshte Cine g— This 1s ones} the app licabien s+ yy tena aurora aiken applications ‘an —| Wet: vvuaiicu wiur vdM| int ann Clooos> — The above ne 1s the syntax Sh Creat; _ On asap e,. looe inkeg B this we! have vesenveck Space for lOoctnkegens. [-_— allocahon ? (Internal fragmentabien._tn_ of Is these memory wastage In_Case_s4, con} fn Int anx Clo]; ~ +Xlo = to bybes | | (24 byte 16 byte Total memory avartable = 24 +}<¢ =Yo byte ——_|bur it is not continvous wb is dis Cuete 2 hence we cant make the aniay ef Ic 1 rake Hence tvs Is memory wastage. Creaking an aniag 1 vouable nan int _anx Clod3 f © size of osu a doka ty be SG a The square bracket: ts a a Fe Avis. the p (Gh Syntax We have nou Rnown. the declaxahen hast — pf omuny As how te. declase the anna — Fixst adds ¢honray (¢ alse known od tthe: base addruys - Dvaimicu winrcam| classmate int oso C7 5 S cout << ann << ends Both gives Same cour << Lam <
. En thy rest ot S voli widt be O- Biron 2C4)= £2746 951235 3 Tis wrbe Give On enon as we have hu ove no-64 elements than the fntttalrred Size. -——_]AQ0 the above asia ‘ Ie dyson. Stabe annoys fe —— Vgc asimays | en QHe Ayanami _axnays Which Wwe wilt cover Sater _Xotell > int 3 7 This wil? yun en seme Cin >>n» 7 compiles. but thi 1s Int ann (nJs J a bod produce an Anos ts a lim te Stowe Clements + ovaiiicu wiul vainFo) BO, 40) sos Tint ann (s3= {1 The antay ele ements cna acctnsed With 2 help of “Indexes lo index 20 Ist fndex ann Bo 2nd index 40 3rd index So 4th Mndex Sn O = based indexing _1s_done.— SF oun ommay — Slats n_»—then index rh Ot bie trem 0 tern-l Cb > te n=l (both. fnclusive) > lo ts the Output _ couk << atm [ol] > Formulas conibie 4 of Dh index (Base addours + gah index * Sige ef dab [oJ 7 Out OX4+ = an 7 This— means thot give the value eae] —— Advts ann which IS the base addnors + Hest Vv eae : ——« lann [1] + ane + + Imeans the next memory fo “ hence So Lhe prea eeh ip Brake the sy al ig fo lp — ee eeittiog “ana Toa fi Orn (1) -~ asl ————————vanicu wrrefamclassmate We use for oop in_pyint ng —oxnay valhees:— $$ for (int ve03 ve Ss c+rt YS DILSDSLDD SLE | 5 Couk << ann (tJ <<“ Output Js Ss lo 20 30 40 50 / | Int aux (lols ” / cout << “Enter Input value in asmay "
> anx CLJ5 3 — Quat Take 5 elements put tn_arary and ____. pocint ther chou bes | Anal int ann C535 7 jae couk << “Enter aunay values” <
> Qu Ct35 7 Tabing i/p fn anna 3 for (int =05 t< 55 tte) i cout << 2 * ann Cr) << 3 3 Printing double of ach Number J axsay Valin: U Quih2 Change att the annoy vaolurs te 1: Trt Ws. 2 fb 3,4, 543 —An Fow (int U=O3L<5 5 c++)f ann (t) = | 5 3 ——_—_—_—re NWN CSTE WITT man” ~ XY for Cink = Tepi 1e 53 batt Dp couk << Ut co sé ca _————___| oe 3 —— ——___Ouxput a | ee ee SS ote ll() ink on (lod; 7 Toinobliged with anboue vy “a ) intonn (lol = {045 PAU valor as ina — wrth O-+ Inihates, ng OHH with O paxtoulon valu We Use ee net Strays and. fu uechons n_pass by value Concept 5 copy 1 creaked L le. io imborkans_4 te: eu > note that when fat paused im Buchan a ten pect ace fet Kop This concap— IS known Ob hors by yeferena. We have te fol a We f ove—afrachica that wheneu \ winston then we need Sunchion- te E204 Void incr (int ans C7 »int < 5 aes aa vuaiicu wiul vamclassmate. int maim () £ int ann (SI = {1,2, 3, 4,535 Cour << ath Cold << endl! Incr Carn, 5) 5 cout << awn Co) << endh5 xetunn 0} Dukput a FRdual say is Updated . Notes|[Para by yeference means that the address | passed & hence a seperate copy Is _not created -_ Why size te E passed ateng with ons in unchions ? Onn [lod ="£121345 ; size of Card = 4o =lo but nod SVR Of Casxn fo) 4 elements in the annoy three 5 that/s why w e need te pas the Size explict bly ______ Linear Seaxch fn Array. _ fpraun C J =£2,9.6,7,4 I Is35 We need te find whethen 6 IS present tn Ox or not ? - Ww each index & See Whether th Js ¢ oy not Fi a Yel 5£ not, move te next index 4vebeat (i) SF present » then tenmrnat: Search. FTexrunat. Scanch if oth the oma elements UL err WITT OAMchecked — ——$ Code in size int | bec Findélement (ink an © »-IDE Stet nth 4 5 cat) { en ew Bacto cee Cj == rey) i if Cann yetunn truss =" al 3 yetuin fatae 37 IF not found even aft 5 Prayers ing whole csixay Qusrd Cunt Os ond -Ls_tn-axhay 4 ay 2 fF element is__ Just traverse the on Zeno sthen do zenoGunk ++ LF cunnenk lelement Is one , then do one Count ++5 Code int own (S3= {1,0,0,1,045 Int zexo Count =o 5 Int one Count =63 ms For Cnt v= 03 tess Vet) f IF Cann (Cl == 0) Zero Count 44° else + As oun artay only have 6 LI Ohe Counk + +5 SC IIcU willl CaMclassmate Qu Find maximum number _in_ the avon }Coud_<< “No. of zeroes are” <
max) f maxt = ann Cis 3 Couk << “Maximum number is ”<
ax cc) f mine = an (cys — 3 — . y nol out << “Minimum oumbex Is” << ming: Qursf Coctreme by L aoa int ou ($3= {15 2, 3, 4, 533 O/p> | 5 2 + 3 This is Guishien st 2 pointes, approach Hee take pboinken as yarwable: L 2 3 4 s Bs Stasve ~en 1) [Print ann (stant) , ann [end )- _ Stank ++ 5 end-~ = £ = 3 + S 7 & Stove end 24 2) _ Pink. . ann [stant] 9Onn Lendl — 6 +, end-~ : ovanneu win Cami 2 3 4. 5 cae Stone end Now it gets byinted twice Tust pur o conditien Sf Start == end, then print onc: We have te Stob when stort qo beyond lend- Code Int aun ($J= €1,2,3, 4,833 Int stant =O.+ 4m Z ink end = 42 While (stasce <= end) t if (stask == end) £ — cout << aun CstaxtJ << 775 break 5 5 : — — cout << arn [Start] <2 05 cout << axh Cend] << “© 75 Staxk +4+5 end--2 3 - Quel Reverse an anna £263.4, 545 int ann CS) * ospy 15.4.3, 22135 _ This can he done via 2 pointer approach. by reploeng Ov (stant) & ann Cend) & abate aanhe as_cxtreme _pyinks: Extreme ped & hence we get the vvuaimicu wiur vdMreyenns 00g ee ee ee L 2 Pz Ss Swap wv fs] & am feJ S++ 5e-- 5 2 3 4 7 € S en Swab ann CsI & onn Le] a ++ ,e-- —— IS 4+ 3 2: ae AX a s € i Swab own (SI & anne) ” S++, e-~ 5 4 3 2 TT Z r 7 £ s = S>e 4 ext rhe loop _-. O/b+ Revense of the inpuk asanoy is what ok rg 7 int awn (S22 4123, 4,555 a Int s = 0) _/ inte= 4) vuaimicu wiur vamclassmate while (s
e , . Scanned with Cam
You might also like
Gate C Notes
PDF
No ratings yet
Gate C Notes
141 pages
Smart Interviews Notes
PDF
No ratings yet
Smart Interviews Notes
75 pages
Data Structre and Algorithm
PDF
No ratings yet
Data Structre and Algorithm
109 pages
ITP-unit-3 Notes
PDF
No ratings yet
ITP-unit-3 Notes
32 pages
FCP LAB Programs
PDF
No ratings yet
FCP LAB Programs
19 pages
OOP Solved Manual - Watermark
PDF
No ratings yet
OOP Solved Manual - Watermark
104 pages
Java Unit 3 @72
PDF
No ratings yet
Java Unit 3 @72
72 pages
Exp1 Oop
PDF
No ratings yet
Exp1 Oop
52 pages
Dynamic Programming
PDF
No ratings yet
Dynamic Programming
47 pages
Dynamic Programming
PDF
No ratings yet
Dynamic Programming
47 pages
CPP 2024 Pyq
PDF
No ratings yet
CPP 2024 Pyq
12 pages
C Language (Unit 2 (Part 1) )
PDF
No ratings yet
C Language (Unit 2 (Part 1) )
20 pages
03 DSA Spiral
PDF
No ratings yet
03 DSA Spiral
25 pages
DS C++ Record 1st Exercise To 6 TH Exsrcise
PDF
No ratings yet
DS C++ Record 1st Exercise To 6 TH Exsrcise
22 pages
Unit 3 Pps
PDF
No ratings yet
Unit 3 Pps
19 pages
Adobe Scan 19 Oct 2024
PDF
No ratings yet
Adobe Scan 19 Oct 2024
20 pages
Java (22 - 45)
PDF
No ratings yet
Java (22 - 45)
24 pages
PPS 5th Assignment With Qna
PDF
No ratings yet
PPS 5th Assignment With Qna
20 pages
C Notes
PDF
No ratings yet
C Notes
241 pages
Unit 3 (PSTC)
PDF
No ratings yet
Unit 3 (PSTC)
14 pages
Unit 4 Pps
PDF
No ratings yet
Unit 4 Pps
11 pages
Logic Building in C++
PDF
No ratings yet
Logic Building in C++
12 pages
Module3 Arrays
PDF
No ratings yet
Module3 Arrays
18 pages
Array Level - 3
PDF
No ratings yet
Array Level - 3
16 pages
AKU PPS Pyq 2019
PDF
No ratings yet
AKU PPS Pyq 2019
11 pages
BCSL 032
PDF
No ratings yet
BCSL 032
16 pages
OOP Assignment 5 and 6
PDF
No ratings yet
OOP Assignment 5 and 6
12 pages
Bhavya 28th January 2023 Notes
PDF
No ratings yet
Bhavya 28th January 2023 Notes
13 pages
Pointer ClassIII Notes 5th March 2023
PDF
No ratings yet
Pointer ClassIII Notes 5th March 2023
7 pages
C-Programming ShortNotes
PDF
No ratings yet
C-Programming ShortNotes
7 pages
Array Extra Cls
PDF
No ratings yet
Array Extra Cls
11 pages
C Programming Notes Part 3
PDF
No ratings yet
C Programming Notes Part 3
24 pages
1
PDF
No ratings yet
1
8 pages
Solution To Source Code For Introduction To Computing (Solution For Laboratory Exercises 5-7)
PDF
No ratings yet
Solution To Source Code For Introduction To Computing (Solution For Laboratory Exercises 5-7)
14 pages
OOP Assignment 1, FA20-BEE-3C-146
PDF
No ratings yet
OOP Assignment 1, FA20-BEE-3C-146
11 pages
MODULE 3 Functions. E-Note
PDF
No ratings yet
MODULE 3 Functions. E-Note
78 pages
CSC2161 C++ Exam With Answers
PDF
No ratings yet
CSC2161 C++ Exam With Answers
16 pages
AD 1 Assignment
PDF
No ratings yet
AD 1 Assignment
32 pages
Basic Handnote of CSE-101 Course
PDF
No ratings yet
Basic Handnote of CSE-101 Course
43 pages
DSA Notes
PDF
No ratings yet
DSA Notes
18 pages
OOPS Practical Mine PDF
PDF
No ratings yet
OOPS Practical Mine PDF
67 pages
PPS Record 27-35 Programs - 240113 - 141016
PDF
No ratings yet
PPS Record 27-35 Programs - 240113 - 141016
28 pages
C++ Record
PDF
No ratings yet
C++ Record
38 pages
PSTC Unit-4
PDF
No ratings yet
PSTC Unit-4
9 pages
CPP Notes - 01
PDF
No ratings yet
CPP Notes - 01
30 pages
C++ Unit 2
PDF
No ratings yet
C++ Unit 2
46 pages
Bhavya 4th February 2023 Notes
PDF
No ratings yet
Bhavya 4th February 2023 Notes
16 pages
Pop IA2
PDF
No ratings yet
Pop IA2
10 pages
Byts Week - 4
PDF
No ratings yet
Byts Week - 4
18 pages
Supermind 4 Unit 9 Exercise
PDF
No ratings yet
Supermind 4 Unit 9 Exercise
8 pages
DSC Notes Module 1
PDF
No ratings yet
DSC Notes Module 1
56 pages
Data Structures Using C and C++ - Y. Langsam, M. Augenstein and A. M. Tenenbaum
PDF
No ratings yet
Data Structures Using C and C++ - Y. Langsam, M. Augenstein and A. M. Tenenbaum
99 pages
C++ Tutorial: ECE 250 Data Structures and Algorithms
PDF
No ratings yet
C++ Tutorial: ECE 250 Data Structures and Algorithms
14 pages