Description: In this video, we discuss the definition, initialization, and operations of arrays, which are another way to store information. It is important to keep in mind that loops are essential to the manipulation of arrays.
ACM CCECC
N/A
AP CS A
[Defining an Array]
VAR-2.A Represent collections of related primitive or object reference data using one-dimensional (1D) array objects.
VAR-2.A.3 Arrays can store either primitive data or object reference data.
VAR-2.A.4 When an array is created using the keyword new, all of its elements are initialized with a specific value based on the type of elements— ● Elements of type int are initialized to 0 ● Elements of type double are initialized to 0.0 ● Elements of type boolean are initialized to false ● Elements of a reference type are initialized to the reference value null. No objects are automatically created
VAR-2.A.5 Initializer lists can be used to create and initialize arrays.
[Accessing and Processing Array Elements]
VAR-2.A.6 Square brackets ([ ]) are used to access and modify an element in a 1D array using an index.
VAR-2.A.7 The valid index values for an array are 0 through one less than the number of elements in the array, inclusive. Using an index value outside of this range will result in an ArrayIndexOutOfBoundsException being thrown.
VAR-2.A.2 The size of an array is established at the time of creation and cannot be changed.
VAR-2.B.3 Since the indices for an array start at 0 and end at the number of elements - 1, “off by one” errors are easy to make when traversing an array, resulting in an ArrayIndexOutOfBoundsException being thrown.
CS1
N/A
Description: Now that we covered the topic of arrays, we demonstrate the use of arrays in this session. To start implementing more complex algorithms, it is important to remember that loops are vital and need to be correctly defined to avoid common logical errors. Initialization is also a highly essential part of knowing how to use arrays, as it can become a time-saver during the testing phase of an algorithm.
Code:
ACM CCECC
N/A
AP CS A
[Accessing and Processing Array Elements]
VAR-2.B Traverse the elements in a 1D array.
VAR-2.B.1 Iteration statements can be used to access all the elements in an array. This is called traversing the array.
VAR-2.B.2 Traversing an array with an indexed for loop or while loop requires elements to be accessed using their indices.
VAR-2.C Traverse the elements in a 1D array object using an enhanced for loop.
CS1
[Accessing and Processing Array Elements]
130.421.c.6.t Identify and use the structured data type of one-dimensional arrays to traverse, search, and modify data.
Description: Knowing how to use arrays along with Strings is essential to the implementation of future algorithms that are related to the use of data for multiple purposes. In this video, we also cover the topic of the ArrayIndexOutOfBounds exception and how to handle it.
Code:
ACM CCECC
N/A
AP CS A
[Accessing and Processing Array Elements]
VAR-2.B Traverse the elements in a 1D array.
VAR-2.B.1 Iteration statements can be used to access all the elements in an array. This is called traversing the array.
VAR-2.B.2 Traversing an array with an indexed for loop or while loop requires elements to be accessed using their indices.
VAR-2.C Traverse the elements in a 1D array object using an enhanced for loop.
CS1
[Accessing and Processing Array Elements]
130.421.c.6.t Identify and use the structured data type of one-dimensional arrays to traverse, search, and modify data.
Description: In this session, we discuss how to use arrays along with methods to use the features that OOP brings to Java: readability, debugging, and reusability.
ACM CCECC
N/A
AP CS A
[Accessing and Processing Array Elements]
CON-2.I For algorithms in the context of a particular specification that requires the use of array traversals— a. Identify standard algorithms b. Modify standard algorithms c. Develop an algorithm;
[Array Operations]
CON-2.I.1 There are standard algorithms that utilize array traversals to— ● Determine a minimum or maximum value ● Compute a sum, average, or mode ● Determine if at least one element has a particular property ● Determine if all elements have a particular property ● Access all consecutive pairs of elements ● Determine the presence or absence of duplicate elements ● Determine the number of elements meeting specific criteria
CS1
N/A
Description: In this session, we discuss how to use arrays along with methods to use the features that OOP brings to Java: readability, debugging, and reusability.
ACM CCECC
N/A
AP CS A
[Accessing and Processing Array Elements]
CON-2.I For algorithms in the context of a particular specification that requires the use of array traversals— a. Identify standard algorithms b. Modify standard algorithms c. Develop an algorithm;
VAR-2.C.1 An enhanced for loop header includes a variable, referred to as the enhanced for loop variable.
VAR-2.C.2 For each iteration of the enhanced for loop, the enhanced for loop variable is assigned a copy of an element without using its index.
VAR-2.C.3 Assigning a new value to the enhanced for loop variable does not change the value stored in the array.
VAR-2.C.4 Program code written using an enhanced for loop to traverse and access elements in an array can be rewritten using an indexed for loop or a while loop.
[Array Operations]
CON-2.I.1 There are standard algorithms that utilize array traversals to— ● Determine a minimum or maximum value ● Compute a sum, average, or mode ● Determine if at least one element has a particular property ● Determine if all elements have a particular property ● Access all consecutive pairs of elements ● Determine the presence or absence of duplicate elements ● Determine the number of elements meeting specific criteria
CON-2.I.2 There are standard array algorithms that utilize traversals to— ● Shift or rotate elements left or right ● Reverse the order of the elements
CS1
N/A