9 processing arrays

RheighHenleyCalderon 2,295 views 17 slides Mar 20, 2012
Slide 1
Slide 1 of 17
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17

About This Presentation

No description available for this slideshow.


Slide Content

% Often advantageous for a user to store several
values for the same variable in the internal
memory of the computer because it decrease:
processing time.

% This multiple storage means there has to bel
more than one memory location in the|
computer for each variable name.

% When more than one memory location ¡sf
designated for a single variable, it is called
an array.

$ When using dynamic arrays, the programmer
designates the number of array locations as
variable, which can be expanded or contract ed!
during the execution of the solution.

% Because computers are zero-based, for
counting purposes, many programming]
languages are also zero-based.

Variable
Reference
Name
AGE(1)
AGE(2)
AGE(3)

AGE(4)

AGE(6)

AGE(7)

AGE(8)

AGE(S)

The number in the
parentheses refers
tothe box number
in the array, the
‘element number.

9
3
E
&

Algorithm Flowchart

LOOP:R = 1 TO N STEP

[extn ao

LOOP-END:R

1h ¿Ri="0)
2. REPEAT

R = R+1
ENTER A(R)

UNTIL A(R) =

*3. N= R-1

-R=1
. ENTER A(R)
. WHILE A(R) <>

R= RH

ENTER A(R)

WHILE — END

LOOP: R=1 TO N STEP 1
[Erınr A(R)

LOOP-END: R

R= Bement number

LOOP:R = 1 TO N STEP 1

[Sum = sum + am)

LOOP-END: R

Number of elements
lement number

Sum of the
elements of A
Rh element of the

locations associated with a single memory variable|
name and designated by row and column numbers.

You load a two-
dimensional array

with nested loops.
The data are
normally loaded
row by row. When|
you load the data
row by row, the|
outer loop
representsthe row,
and the inner loop
represents the
column

E

LOOP:R = 1 TO NR STEP 1

LOOP: C = 1 TO NC STEP 1

JA(R,NC + 1,
+ A(R,C)

JA(NR + 1,0)
+ A(R,C)

A(R,NC + 1)
A(NR + 1,C
LOOP-END: C

A(NR + 1,NC + 1) =

A(NR + 1, NC + 1
+A(R, NC + 1)

In some cases there is a need for arrays with a third or|
leven a fourth dimension. These arrays are called]
multidimensional arrays.

Advanta

# Facilitate an

understanding
of the data

# Improve the
readability of

value in a table. A one-dimensional array would be used if the]
element number can be utilized as the given value. A two-
dimensional array with two columns would be used if the element
number cannot be utilized.

coment igor Lowen:

ENTER MONTH
2 DAYS OF THE MONTH =
Days MONTE)

3 PRINT DA
Tags