Glossary
AP Pseudocode Indexing
The convention in AP Computer Science Principles pseudocode where list elements are accessed starting from index 1, unlike many programming languages that start at 0.
Example:
If a list has 3 items, the first item in AP Pseudocode Indexing would be at index 1, not 0.
Accessing Elements by Index
The process of retrieving a specific value from a list by referring to its numerical position (index) within the list.
Example:
To get the second item from my_scores = [85, 92, 78], you would use my_scores[1] (in Python) or my_scores[2] (in AP Pseudocode).
Append (List Operation)
A list operation that adds a new element to the very end of a list.
Example:
If you have a list of high scores scores = [100, 95], using scores.append(110) would append 110 to the end, making it [100, 95, 110].
Assigning Element Values
The operation of changing the value of an existing element at a specific index within a list.
Example:
If colors = ['red', 'blue', 'green'], assigning element values like colors[1] = 'yellow' would change the list to ['red', 'yellow', 'green'].
Complete Traversal
A type of list traversal where every single element in the list is processed or visited exactly once.
Example:
Calculating the average of all grades in a class requires a complete traversal of the list of grades.
Insert (List Operation)
A list operation that adds a new element at a specified index, shifting existing elements to make room for the new item.
Example:
Using my_queue.insert(0, 'priority_task') would place 'priority_task' at the very beginning of the my_queue list.
Length (List Operation)
A function or operation that returns the total number of elements currently in a list.
Example:
For a list students = ['Alice', 'Bob', 'Charlie'], len(students) would return 3, indicating its length.
Linear Search
An algorithm that sequentially checks each element in a list until the desired element is found or the end of the list is reached.
Example:
Finding a specific book in an unsorted pile by checking each book one by one is an example of a linear search.
List
A fundamental data structure in programming that stores an ordered collection of items, which can be of various data types.
Example:
A shopping list like ['apples', 'bread', 'milk'] keeps items in a specific order.
Looping Through Lists
The process of iterating over each element in a list, typically using a `for` or `while` loop, to perform an action on each item.
Example:
Looping through lists allows you to print every song title in a playlist or calculate the sum of all numbers in a data set.
Partial Traversal
A type of list traversal where only a specific subset or portion of the elements in a list is processed.
Example:
If you only need to check the first five items in a very long inventory list, you would perform a partial traversal.
Remove (List Operation)
A list operation that deletes the first occurrence of a specified value from the list.
Example:
If tasks = ['clean', 'cook', 'clean'], tasks.remove('clean') would remove only the first 'clean', resulting in ['cook', 'clean'].