返回卡包市场

Computational Complexity

暂无描述。系统推荐的高质量记忆内容,适合每天坚持背诵学习。

卡片总数: 24内容版本: v4公开卡包更新时间: 8/1/2026

卡片预览 (24 张)

#1
正面 (问题)

Understand efficiency of programs

背面 (解答)

Separate time and space efficiency of a program

#2
正面 (问题)

Challenges

背面 (解答)

• a program can be implemented in many different ways • solve a problem using only a handful of different algorithms • separate choices of implementation from abstract algorithms

#3
正面 (问题)

Evaluate efficiency

背面 (解答)

• use a timer • count operations • abstract notion of order of growth

#4
正面 (问题)

Timing a program

背面 (解答)

• start clock • call function • stop clock

#5
正面 (问题)

Timing programs is inconsistent

背面 (解答)

GOAL to evaluate diff. algorithms

#6
正面 (问题)

Running time -(time varies for different inputs, but cannot really express a relationship between inputs and time!)

背面 (解答)

+ varies between algorithms • varies between implementations • varies between computers • not predictable based on small inputs

#7
正面 (问题)

Which operations to count

背面 (解答)

Assumes steps take constant time • mathematical operation • comparisons • assignments • accessing objects in memory

#8
正面 (问题)

Counting operations, better but…

背面 (解答)

GOAL to evaluate different algorithms

#9
正面 (问题)

Counting operations +(count varies for diff. inputs and can come up with a relationship between inputs and the count)

背面 (解答)

+ depends on algorithm - depends on implementation - independent of computers + no real def. of which operations to count

#10
正面 (问题)

Needs a better way what we HAVE

背面 (解答)

• timing and counting evaluate implementations * timing evaluates machines

#11
正面 (问题)

what we WANT

背面 (解答)

• evaluate algorithm • evaluate scalability • evaluate in terms of input size

#12
正面 (问题)

Need to which input to use

背面 (解答)

• efficiency in terms of input • could be an integer • could be length of list • you decide

#13
正面 (问题)

Different inputs

背面 (解答)

• first element in a list -> BEST CASE • not in list -> WORST CASE • look through half -> AVG CASE

#14
正面 (问题)

Best case

背面 (解答)

min. running time - constant - first element of any list

#15
正面 (问题)

Average case

背面 (解答)

avg. running time - practical measure

#16
正面 (问题)

Worst case

背面 (解答)

max. running time - linear in length of list - must search entire list

#17
正面 (问题)

Orders of Growth - goal

背面 (解答)

• input is very big • growth of program’s run time • upper bound • do not need to be precise “order of” not “exact” • largest factor

#18
正面 (问题)

Input is very big

背面 (解答)

Want to evaluate programs efficiency when input is very big

#19
正面 (问题)

Growth of program’s run time

背面 (解答)

Want to express program’s run time as input grows

#20
正面 (问题)

Upper bound

背面 (解答)

Want to put an upper bound on growth

#21
正面 (问题)

“order of” not “exact”

背面 (解答)

Do not need to be precise “order of” not “exact” growth

#22
正面 (问题)

Largest factor

背面 (解答)

We will look at largest factor in run time

#23
正面 (问题)

Types of orders of growth

背面 (解答)

- constant \+ linear - quadratic - logarithmic \+ n log n - exponential

#24
正面 (问题)

Measuring Order of Growth

背面 (解答)

Big Oh Notation