AP CSP Create Code Example
Algorithms and Abstractions
AP CSP emphasizes the use of algorithms and abstractions in the Create task. While the AP definitions may seem vague, algorithms and abstractions are simple concepts that are used both in everday life and in all computer programs.
An algorithm is simply a method or function that uses logic and math that takes in an input and produces a specific output. An example of an algorithm is a method that takes in two numbers and adds them; if the function addNumbers(2,2) returns 4, then addNumbers is an algorithm.
Whether it's taking in numbers and outputting a specific answer, solving a Rubik's cube, or outputting a list of items in a specific order, an algorithm is simply a set of steps of math and logic that something uses to obtain a specific output.
An abstraction is anything that takes a set of complex tasks and refers to all of the steps together as one process. In other words, an abstraction is a container of steps that people refer to by the name of the abstraction rather than the names of each of the steps.
For example, a camera is an abstraction; instead of calling the buttons, lenses, autofocus and zoom functions individually, these things collectively are referred to as a camera.
An example of an abstraction in programming is a function. Instead of reffering to all of the steps that are in the function, only the function's name is called (for example, instead of saying "a method that adds all numbers and then divides by the quantity" it is referred to as a function called average(). This allows programmers to set up complex functions, methods, and algorithms that can be called at any time by just typing in the abstraction name.
For specific criteria, accepted filetypes, and detailed instructions explaining how to submit the video and code, please always refer to the AP CSP Course Overview.