Array Review
Subscripts, Declaration, Allocation.
Sorting Arrays
Why you shouldn't write your own sort.
Arrays -- Multi-dimensional
All arrays in Java are really linear, one-dimensional arrays. However, you can easily build multi-dimensional arrays from these, and Java has features in the language to help you do this..
Mean - average
Computing the arithmetic average (mean) can be done in one pass over all the array elements..
Array - Maximum
There is one common variation on this -- sometimes it isn't the maximum value that is desired, but the index of the maximum value..
Reverse an array
This version of reverse uses two subscripts: one that starts at the left (beginning) of the array, and one that starts at the right (end) of the array..
Bubble Sorts
One nice aspect of bubble sorts is that they can quit early if the elements are almost sorted..
Selection Sort
Selection sort is implemented with two nested loops..
Arrays -- Examples
This applet shows a number of methods that use arrays..
Arrays -- 2-dimensional
2-dimensional arrays are usually represented in a row-column approach on paper, and the terms "rows" and "columns" are used in computing..
Arrays -- Intermediate
Java 2 added anonymous arrays, which allow you to create a new array of values anywhere in the program, not just in an initialization in a declaration..
Arrays
An array can store many similar values in memory. Each value can be accessed by specifying a subscript or index..