AP Computer Science a Flashcards: Informal Run Time Analysis

Study Informal Run Time Analysis in AP Computer Science a with focused flashcards that help you recognize the idea, recall the key rule, and apply it in practice-style prompts.

QUESTION

Identify the Big O for the best-case of insertion sort.

Tap card or press Space to flip

ANSWER

O(n)O(n). Array is already sorted requiring minimal operations.

1 / 38

AP Computer Science a: Selection and Iteration

All flashcards

38 cards

What this deck covers

This deck focuses on Informal Run Time Analysis, giving you a quick way to review the definitions, rules, and examples that matter most for AP Computer Science a.

How to use these flashcards

Work through these flashcards in short sessions. Try to answer each prompt before flipping the card, then revisit any cards you miss until the explanation feels automatic.

Practice questions

1 of 19Practice questions for this set
A student counts how many pairs of different values appear in an int[] of size nn.
public static int countDifferentPairs(int[] data) {
    int count = 0;
    for (int i = 0; i < data.length; i++) {
        for (int j = i + 1; j < data.length; j++) {
            if (data[i] != data[j]) {
                count++;
            }
        }
    }
    return count;
}
What is the run-time complexity of the algorithm in the code snippet?
Choose an answer

Keep your progress across every deck

Free account · cards you mark are saved to it