Please enable JavaScript to use CodeHS

APCSP20: AAP-2.N.1

CodeHS Lessons

The exam reference sheet provides basic operations on lists include: accessing an element by index; aList[i] accesses the element of aList at index i. The first element of aList is at index 1 and accessed using the notation alist[1]; assigning a value of an element of a list to a variable; x ← aList [i] - assigns the value of aList[i] to the variable x; assigning a value to an element of a list; aList[i] ← x - assigns the value of x to aList[i]. aList[i] ← aList[j] - assigns the value of aList[j] to aList[i]. inserting elements at a given index; INSERT(aList, i, value) - any values in aList at indices greater than or equal to i are shifted one position to the right. The length of the list is increased by 1, and value is placed at index i in aList. adding elements to the end of the list (append); APPEND(aList, value) - the length of aList is increased by 1, and value is placed at the end of the aList. removing elements; and REMOVE(aList, i) - Removes the item at index i in aList and shifts to the left any values at indices greater than i. The length of aList is decreased by 1. determining the length of a list. LENGTH(aList) – Evaluates to the number of elements currently in aList.

Standard
7.1 Intro to Lists/Arrays
7.7 Removing an Element From an Array
Standard
7.2 Lists
7.4 List Methods
Standard
7.1 Intro to Lists/Arrays
7.7 Removing an Element From an Array
Standard
7.1 Intro to Lists/Arrays
7.7 Removing an Element From an Array
Standard
6.1 Intro to Lists/Arrays
6.7 Removing an Element From an Array
Standard
6.1 Intro to Lists/Arrays
6.7 Removing an Element From an Array
Standard
4.1 Intro to Lists/Arrays
4.7 Removing an Element From an Array
Standard
6.1 Intro to Arrays and Accessing an Element in an Array
6.3 Looping Through Arrays