Sequencing

What Is Sequencing in AP CSP?

In AP Computer Science Principles, sequencing is one of three basic algorithm types, with selection and iteration. Learn what it means and how to trace it.

On this page
  1. The short answer
  2. The three algorithm types
  3. Sequencing in practice
  4. Tracing code
  5. How sequencing fits with the other two types
  6. Course version changes
  7. Common mistakes in AP CSP
  8. Summary

The short answer

In AP Computer Science Principles (AP CSP), sequencing is the idea that a program’s steps run one after another, in order. It is one of three basic algorithm types in the course, along with selection and iteration.

The three algorithm types

  • Sequencing: steps run in the order they are written.
  • Selection: a condition decides which steps run, as with an if statement.
  • Iteration: a set of steps repeats, as with a loop.

Course materials ask students to build programs that include all three types, and to trace code that uses them. Tracing means working through the code one step at a time to predict what it does.

Sequencing in practice

Here is a short example:

total = 0
total = total + 5
total = total * 2
print(total)

The program prints 10. A student tracing it would write down the value of total after each line: 0, then 5, then 10.

Tracing code

A trace table is a common way to organize this work. List each variable in a column, then add a row for each line that runs. Update the values as you go, and use the table’s last row to predict the output. Tracing is most useful when a program has a mix of all three algorithm types, because it shows which lines run and which are skipped.

How sequencing fits with the other two types

Sequencing gives the default order. Selection and iteration change that order. A program might read a value, use an if statement to choose a path, and then repeat a step in a loop. Each part is simple on its own, and the trace shows how they combine.

For the choice part, see what is selection in computer science. Outside AP CSP, sequence also has a data meaning, covered in what does sequence mean in computer science.

Course version changes

The College Board is revising the course framework for fall 2027. Groupings and unit names may differ from the current course and exam description, so check the version your class uses.

Common mistakes in AP CSP

  • Confusing a sequence of statements with a loop that repeats them.
  • Forgetting that a variable must be assigned before it is used.
  • Tracing a program without updating the variables after each line.

Summary

  • Sequencing means a program’s steps run one after another, in order.
  • It is one of three basic algorithm types in AP CSP, with selection and iteration.
  • Tracing code line by line is the main way to check what a program does.

The complete guide to sequencing

What Is Sequencing in Computer Science?
Read the guide

Keep exploring

Guides from other topics

All topics →

Big O for Data Structures

A practical guide to Big O for data structures: how arrays, lists, hash tables, trees and heaps compare on search, insert and delete costs, with examples.

Big O Notation 5 min read