CPSC 203, 2025 W1
September 9, 2025
Website getting closer – Only setup is wrong (I think)
POTW starts today! https://us.prairielearn.com/pl/course_instance/193300/assessment/2580122
Enroll in CPSC203 on PrairieTest: https://us.prairietest.com/pt/student/course/12360/enroll/172611186041
First examlet signup available!
We connect the idea of “elegance” to common items and to software design!
The time it takes to solve a problem is one way of measuring the size of a problem. That time can often be described by simple mathematical function.
Find 2 images, one which exemplifies your definition of elegance, and another, of the same type of subject, which decidedly does not.
Navigate to the Elegance Gallery: https://tinyurl.com/elegancegallery
Claim an available slide by entering a title.
Upload your images, and then you’re done!
I will move slides to the COMPLETED section of the gallery.
10:00
Scissors
Gallery: https://tinyurl.com/elegancegallery
After looking at the images in the gallery, reflect and write a short definition of the word elegance:
https://forms.gle/GL3yNZn7i7DT5qxW9
05:00
How does this apply to the way we solve problems in computing?
Ingenuity:
Simplicity:
Simplicity is the ultimate sophistication. It takes a lot of hard work to make something simple, to truly understand the underlying challenges and come up with elegant solutions. […] It’s not just minimalism or the absence of clutter. It involves digging through the depth of complexity. To be truly simple, you have to go really deep. […] You have to understand the essence of a product in order to be able to get rid of the parts that are not essential.
— Steve Jobs
The language used to communicate patterns uses exactly the same fundamental constructs as Python!!!
General idea: quantify the size of the problem (\(n\)) and consider the cost of our task as that size increases.
05:00
If we are solving a problem ____________ for a given input, we can parameterize the running time of the solution by the size of the input.
We usually denote this input size using the variable \(n\).
Discussion:
Knitting model:
Side length is \(n\)
One stitch is a unit of work
\(n\) rows, \(n\) stitches per row
Total work is \(n^2\)
Suppose we can knit 1012 stitches per second…
10 | 100 | 1000 | 10,000 | 1012 | |
---|---|---|---|---|---|
\(n\) | 10-11s | 10-10 s | 10-9 s | 10-8 s | 1 s |
\(n \log n\) | 10-11 s | 10-9 s | 10-8 s | 10-7 s | 40 s |
\(n^2\) | 10-10 s | 10-8 s | 10-6 s | 10-4 s | 1012 s |
\(n^3\) | 10-9 s | 10-6 s | 10-3 s | 1 s | 1024 s |
\(2^n\) | 10-9 s | 1018 s | 10289 s |
The amount of computation we do inside our algorithm actually matters!
Elegance
Growth of simple functions over time
Representing complexity of a problem using time
Running time of a Python function