Common Array Algorithms
This chapter discusses how a for loop can be used to iterate over the elements of a one-dimensional array. In addition, it also discusses enhanced for loops. The chapter demonstrates the use of arrays to solve common problems such as finding sum, average, maximum, and minimum values of numbers stored in array. Pay attention to some of the common programming errors one can make while using arrays.
26. End of the Chapter
Answer:
Yes. Usually you would use a class method. See the exercises.
End of the Chapter
That about wraps it up for this chapter. If you feel equal to it, you may wish to review the following topics.
- counting loop, and array Counting loops and arrays.
- array length The
length
attribute of an array. - array length, dynamic Array length determined at run time.
- enhanced for loop Enhanced for loops
- Algorithm for determining the array, maximum maximum element.
- Algorithm for determining the array, minimum minimum element.
- Algorithm for determining the array, sum sum of the elements in an array.
- Algorithm for determining the array, average average of the elements in an array.
- A definition of array equality equality, arrays
- Methods of the Array class Array, class