Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 1 out of 4 pages
Summary

Computer Science 144 4.1 summary

Document preview thumbnail
Preview 1 out of 4 pages

Detailed summary of Chapter 4.1 - performance in Python for CS144 at Stellenbosch University. All you need to study from Chapter 4.1 for the A1.

Content preview

Chapter 4.1 PERFORMANCE:
Mantra for this chapter: Pay attention to the cost
We apply mathematical analysis to derive concise models of the cost - the experiments we
design must be reproducible and falsifiable
How are the experiments done? We can simply run a program on various inputs, measuring
the amount of time to process each input.
Observations:
1. is a problem size that characterizes the difficulty of the computational task.
Normally, the problem size is either the size of the input or the value of a command-
line argument. Intuitively, the running time should increase with the problem size –
interested in how much it increases by.
2. Running time is relatively insensitive to the input itself; it depends primarily on the
problem size
Proper analysis involves:
- Detailed understanding of the program
- Detailed understanding of the system and the computer
- Advanced tools of mathematical analysis
Doubling hypothesis -> What is the effect on the running time of doubling the size of the
input?
Mathematical analysis:
the total running time is determined by two primary factors:
- The cost of executing each statement (property of the system)
- The frequency of execution of each statement (property of the algorithm)
We write ~f(n) to represent any quantity that, when divided by f(n), approaches 1 as n
grows. We also write g(n) ~ f(n) to indicate that g(n)/f(n) approaches 1 as n grows.
We focus on the instructions that are executed most frequently = inner loop
For many programs: the running time satisfies the relationship T(n) ~ cf(n) where c is a
constant and f(n) is a function known as the order of growth of the running time = simple
but powerful model of running time. With these approximations, the particular machine
that you are using does not play a significant role in the models—the analysis separates the
algorithm from the system (algorithm determines the order of growth)

Connected book
 image
Robert Sedgewick, Kevin Wayne, Robert Dondero Introduction to Programming in Python
Publisher: 2015 ISBN: 9780134076430 Edition: Unknown

Document information

Summarized whole book?
No
Which chapters are summarized?
Chapter 4.1 - performance
Uploaded on
September 27, 2023
Number of pages
4
Written in
2023/2024
Type
Summary
$4.52

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
6
Followers
2
Items
14
Last sold
1 month ago




Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions