Download presentation
Presentation is loading. Please wait.
Published byBarbara Jefferson Modified over 9 years ago
1
Introduction to C++ Programming Language Assistant Professor Jeon, Seokhee Assistant Professor Department of Computer Engineering, Kyung Hee University, Korea
2
CHAPTER 8 Array
3
Derived Types
4
Ten Variables
5
Processing Ten Variables
6
An Array of Scores
7
The Scores Array
8
Loop for Ten Scores
9
Declaring and defining arrays
10
Initializing arrays
11
Exchanging scores-the wrong way
12
Exchanging scores with temporary variable
13
Squares Array
14
Print Input Reversed
15
Passing individual elements to function
16
Passing arrays—average Prevent x from being changed. Use x just for refering Prevent x from being changed. Use x just for refering
17
Changing values in arrays
18
Random Number Permutation
19
SORTING IN ARRAY
20
Selection sort concept
21
Selection sort example
22
Selection Sort Code
23
Bubble sort concept
24
Bubble sort example
25
Bubble Sort Code
26
Insertion sort concept
27
Insertion sort example
28
Insertion Sort Code
29
SEARCHING IN ARRAY
30
Search concept
31
Sequential Search
32
Unsuccessful search
33
Sequential Search Code
34
Binary search example Note that the list is already sorted
35
Unsuccessful binary search example
36
Binary Search Code
37
Useful materials on sorting and searching algorithms http://www.sorting-algorithms.com/ http://www.cosc.canterbury.ac.nz/mukundan/ds al/appldsal.html http://www.cosc.canterbury.ac.nz/mukundan/ds al/appldsal.html http://www.cs.auckland.ac.nz/~jmor159/PLDS2 10/alg_anim.html http://www.cs.auckland.ac.nz/~jmor159/PLDS2 10/alg_anim.html
38
Two-dimensional array
39
Array of arrays
40
Memory layout
41
Passing a row
42
Calculate average of integers in array
43
Fill Matrix
44
A three-dimensional array (3 x 5 x 4)
45
C++ view of three-dimensional array
46
Initializing a three-dimensional array
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.