OSSU-computer-science/archives/01-introduction-to-computer-science-and-programming/archives/UNIT-01/03-problem-solving
2014-05-28 10:42:20 -03:00
..
.loops.py.swp add fossilized pattern 01.01.03 2014-05-28 10:40:47 -03:00
lec03.py finish code example 1.1.3 2014-05-22 18:18:20 -03:00
loops.py add missed-condition pattern 01.01.03 2014-05-28 10:42:20 -03:00
README.md add 1.1.3 link algorythm 2014-05-20 19:50:25 -03:00

1.1.3 Problem Solving

Back to table of contents

Session Overview

This lecture covers the use of iteration to build programs whose execution time depends upon the size of inputs. It also introduces search problems and brute force and bisection for solving them.

Session Activities

Lecture Videos

  • Lecture 3: Problem Solving (00:47:56)
    • About this video: Topics covered: Termination, decrementing functions, exhaustive enumeration, brute force, while loop, for loop, approximation, specifications, bisection search.
  • Resources

Check Yourself

What does it mean for a program to terminate?

Either the program will return a value, or throw an exception. A program that does not terminate runs indefinitely, typically because it's gotten stuck in a loop.

What is a for loop?

A for loop takes some sort of iterable object (a list, tuple, or string) and performs its function once for each item in that object. Any function that depends on the input can have a different result at each step, since the input is the current item.

Further Study

Readings

  • Loops. An Introduction to Python.