Programming Essentials Using Java by McAllister William & Fritz S. Jane
Author:McAllister, William & Fritz, S. Jane
Language: eng
Format: epub
Publisher: Mercury Learning and Information
Published: 2017-02-22T05:00:00+00:00
CHAPTER 6
ARRAYS
6.1 The Origin of Arrays
6.2 The Concept of Arrays
6.3 Declaring Arrays
6.4 Arrays and Loops
6.5 Arrays of Objects
6.6 Passing Arrays Between Methods.
6.7 Parallel Arrays
6.8 Common Array Algorithms
6.9 Application Programming Interface Array Support
6.10 Multi-dimensional Arrays
6.11 Additional Searching and Sorting Algorithms
6.12 Deleting, Modifying, and Adding Disk File Items
6.13 Chapter Summary
In this chapter
In this chapter, we will introduce the concept of an array and the powerful features of the construct that make it a part of most programs. These features include the ability to store and retrieve large data sets, and, when combined with the concept of a loop, these data sets can be processed with only a few instructions. Array processing algorithms such as sorting, searching, and copying will be discussed and implemented, as will algorithms introduced in Chapter 4 for inserting and deleting items stored in a disk text file. We will also explore the API methods that implement many of the classical array processing algorithms.
One-dimensional arrays, which can be used to store a list of items, will be discussed as well as multi-dimensional arrays, and we will use two-dimensional arrays to organize data in tables as rows and columns.
After successfully completing this chapter you should:
• Understand the advantages and importance of using arrays
• Be familiar with the Java memory model used to store arrays
• Be able to construct and use arrays of primitives and objects
• Understand and be able to implement the algorithms used to search an array, sort it, and find the minimum and maximum values stored in it
• Be familiar with and be able to use the array-processing methods in the API
• Understand the concept of parallel arrays and use them to process data sets
• Know how to use arrays to insert, delete, or update data items stored in a disk file
• Be able to apply array techniques to game programs
6.1 THE ORIGIN OF ARRAYS
The machines we call computers received their name because the first operational versions of these machines were primarily used by mathematicians to perform rapid computations on large data sets. They were machines whose task was to compute; they were computers. However, long before computers were operational, mathematicians were using subscripted variables, such as x2 or x4, to represent the data used in their formulas and calculations, so it was natural for them to want to use these subscripted variables in the formulas evaluated by these early computing machines.
To facilitate the writing of these subscripted variables into a program, the designers of FORTRAN (which stands for Formula Translation), the first high level programming language used by mathematicians, included a construct that modeled subscripted variables. The construct was named array. Thus, the computer concept of an array has its roots in the mathematical model of subscripted variables.
6.2 The Concept of Arrays
Consider a program that processes five people’s ages stored in the integer memory cells age0, age1, age2, age3, and age4. The declaration of these variables would be rather straightforward:
int age0, age1, age2, age3, age4;
But suppose that instead of processing five people’s ages, the program processed five million people’s ages.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8296)
Test-Driven Development with Java by Alan Mellor(6705)
Data Augmentation with Python by Duc Haba(6612)
Principles of Data Fabric by Sonia Mezzetta(6367)
Learn Blender Simulations the Right Way by Stephen Pearson(6261)
Microservices with Spring Boot 3 and Spring Cloud by Magnus Larsson(6127)
Hadoop in Practice by Alex Holmes(5958)
Jquery UI in Action : Master the concepts Of Jquery UI: A Step By Step Approach by ANMOL GOYAL(5806)
RPA Solution Architect's Handbook by Sachin Sahgal(5526)
Big Data Analysis with Python by Ivan Marin(5353)
The Infinite Retina by Robert Scoble Irena Cronin(5223)
Life 3.0: Being Human in the Age of Artificial Intelligence by Tegmark Max(5144)
Pretrain Vision and Large Language Models in Python by Emily Webber(4312)
Infrastructure as Code for Beginners by Russ McKendrick(4074)
Functional Programming in JavaScript by Mantyla Dan(4038)
The Age of Surveillance Capitalism by Shoshana Zuboff(3946)
WordPress Plugin Development Cookbook by Yannick Lefebvre(3788)
Embracing Microservices Design by Ovais Mehboob Ahmed Khan Nabil Siddiqui and Timothy Oleson(3590)
Applied Machine Learning for Healthcare and Life Sciences Using AWS by Ujjwal Ratan(3566)
