Module 3: Algorithm Analysis

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/17

flashcard set

Earn XP

Description and Tags

Last updated 3:48 PM on 8/2/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

18 Terms

1
New cards

Intstance

Specific data that satisfies the input specification of a problem

2
New cards

Order Notation

Notation used to categorize functions into groups specified by simple functions; also called asymptotic notation

3
New cards

Pseudocode

CS 231’s way to describe code using a compromise between English and a model of computation

4
New cards

Algorithm Sketch

a description of an algorithm in sentences or point form

5
New cards

Paradigm

A systematic approach to designing algorithms

6
New cards

What is the cost of assigning a value to a variable?

θ(1)

7
New cards

What is the cost of using a variable?

θ(1)

8
New cards

What is the cost of using an arithmetic or Boolean operation or a comparison?

θ(1)

9
New cards

What is the cost of moving to another line in the program?

θ(1)

10
New cards

What is the cost of returning a value using return?

θ(1)

11
New cards

Cost of Iteration Management

Cost of ensuring that the loop is executed the correct number of times

12
New cards

Cost of Loop Body

The cost of the indented lines executed during each iteration

13
New cards

What is the basic costs of iteration management?

constant time per iteration

14
New cards

What is an example of any non-constant costs that will be add to the cost of each iteration?

calling a non-constant function to determine the size of a range or within a condition for a while loop

15
New cards

Loop Common Situation 1

The cost of each iteration is asymptotically the same for each iteration (that is, each iteration has a cost in for some function g(n)).

The cost of the loop = the number of iterations × cost of one iteration.

16
New cards

Loop Common Situation 2

The cost of iteration i is in θ(i).

The cost of the loop is θ(k²), where k is the number of iterations.

17
New cards

Upper Bound O

Describes an algorithm can run at most in O(?) time.

18
New cards

Recipe for Analyzing Worst-Case Running Time

  • Break each block into blocks.

  • Determine a bound on each block individually.

  • Retain all dominant costs.

  • Use θ if all costs are expressed in θ and can occur simultaneously and use otherwise.