Presentation is loading. Please wait.

Presentation is loading. Please wait.

Algorithms September 28, 2017.

Similar presentations


Presentation on theme: "Algorithms September 28, 2017."— Presentation transcript:

1 algorithms September 28, 2017

2 algorithms An algorithm is a precise sequence of instructions for a process that can be executed by a computer and is implemented using a programming language. Essentially, a list of steps to take.

3 Phone book example Suppose we have a phone book with 1000 pages and want to search for “Joe Smith.” What are two ways we could do this?

4 Algorithm 1 Open to page 1. If “Joe Smith” is not listed on the current page, turn to the next page. Stop when you’ve found “Joe Smith.”

5 Algorithm 2 Open to the middle of the phone book (page 500).
If “Joe Smith” is among the names on this page, stop. If not, determine whether “Smith” is earlier or later. If earlier, open to page 250 (middle of the left half). If later, open to page 750 (middle of the right half). Return to step 2.


Download ppt "Algorithms September 28, 2017."

Similar presentations


Ads by Google