314 Arrays (Web file server) Chapter 7 Outline 7.1 Introduction 7.2
314 Arrays Chapter 7 Outline 7.1 Introduction 7.2 Arrays 7.3 Declaring and Allocating Arrays 7.4 Examples Using Arrays 7.4.1 Allocating an Array and Initializing Its Elements 7.4.2 Using an Initializer List to Initialize Elements of an Array 7.4.3 Calculating the Value to Store in Each Array Element 7.4.4 Summing the Elements of an Array 7.4.5 Using Histograms to Display Array Data Graphically 7.4.6 Using the Elements of an Array as Counters 7.4.7 Using Arrays to Analyze Survey Results 7.5 References and Reference Parameters 7.6 Passing Arrays to Methods 7.7 Sorting Arrays 7.8 Searching Arrays: Linear Search and Binary Search 7.8.1 Searching an Array with Linear Search 7.8.2 Searching a Sorted Array with Binary Search 7.9 Multiple-Subscripted Arrays 7.10 (Optional Case Study) Thinking About Objects: Collaboration Among Objects Summary Terminology Self-Review Exercises Answers to Self-Review Exercises Exercises Recursion Exercises Special Section: Building Your own Computer 7.1 Introduction This chapter serves as an introduction to the important topic of data structures. Arrays are data structures consisting of related data items of the same type. Arrays are static entities, in that they remain the same size once they are created, although an array reference may be reassigned to a new array of a different size. Chapter 19, Data Structures, introduces dynamic data structures, such as lists, queues, stacks and trees, that can grow and shrink as programs execute. Chapter 20, Java Utilities Package and Bit Manipulation, discusses class Vector, which is an array-like class whose objects can grow and shrink in response to a Java program s changing storage requirements. Chapter 21, The Collections API, introduces Java s predefined data structures that enable the programmer to use existing data structures for lists, queues, stacks and trees rather than reinventing the wheel. The Collections API also provides class Arrays, which defines a set of utility methods for array manipulation. Copyright 1992 2002 by Deitel & Associates, Inc. All Rights Reserved. 7/3/01