0% found this document useful (0 votes)
2 views2 pages

MIT 6.0001 Intro to Comp Sci and Programming in Python 3

The document discusses various algorithms, focusing on the bisection search method, which efficiently narrows down search spaces by halving the range with each guess. It also covers the guess and check method and approximate solutions, highlighting their strengths and limitations. Practical demonstrations illustrate the effectiveness of bisection search compared to traditional methods.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

MIT 6.0001 Intro to Comp Sci and Programming in Python 3

The document discusses various algorithms, focusing on the bisection search method, which efficiently narrows down search spaces by halving the range with each guess. It also covers the guess and check method and approximate solutions, highlighting their strengths and limitations. Practical demonstrations illustrate the effectiveness of bisection search compared to traditional methods.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Topic: Algorithms and Bisection Search

1. Robot Cheerleaders:

Example of a program that acts as a cheerleader.


User inputs a word and a level of enthusiasm.
The program spells out the word like a cheerleader and repeats it based on the enthusiasm
level.
Demonstrates the use of loops and string manipulation.

2. Toolbox Expansion:

Added knowledge:
Integers, floats, booleans.
String manipulation.
Math operations.
Conditionals and branching.
Loops: for and while.

3. Algorithms:

Don't be intimidated by the term "algorithm".


Three algorithms to be discussed:
Guess and Check
Approximation Algorithm
Bisection Search

4. Guess and Check Method:

Also known as exhaustive enumeration.


Start with a guess and check if it's correct.
If not, guess another value systematically.
Continue until a solution is found or all possible values are exhausted.

5. Approximate Solutions:

Useful when an exact solution isn't necessary.


Start with a guess and increment by a small value.
Continue until a "good enough" solution is found.
Two factors to consider:
Step size: Smaller step size = more accurate but slower.
Epsilon: Determines how close is "good enough".

6. Bisection Search:
A more efficient method than guess and check.
Divide the search space in half with each guess.
Choose a guess halfway between the current high and low boundaries.
Adjust boundaries based on whether the guess is too high or too low.
Continue until the guess is within an acceptable range (epsilon).
Converges on the order of log base n, making it powerful for large search spaces.

7. Practical Demonstration:

A game was played to guess a number between 0 and 100.


Using bisection search, the number was guessed in fewer steps than traditional methods.
Demonstrated the efficiency of bisection search.

8. Limitations and Adjustments:

The bisection search code shown only works for positive cubes.
For numbers less than 1, the cube root will be outside the initial boundary.
A small adjustment can be made to the code to account for this.

Conclusion:

Algorithms are essential tools in computer science and programming.


Different algorithms have their strengths and weaknesses.
Bisection search is a powerful method for quickly narrowing down a search space.

You might also like