Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 14 Go over midterm results Algorithms Efficiency More on prime numbers.

Similar presentations


Presentation on theme: "Lecture 14 Go over midterm results Algorithms Efficiency More on prime numbers."— Presentation transcript:

1 Lecture 14 Go over midterm results Algorithms Efficiency More on prime numbers

2 Solutions to Midterm Exam Question 1 Question 2 Question 3 Question 4

3 Algorithms An algorithm is a specified set of steps for solving a prescribed problem. It does not have to be written in any particular formal language, but it has to be intelligible to a reader and completely unambiguous. It usually has input and always has output. It must terminate in finite time, for all possible input.

4 Implementation of an Algorithm An implementation of an algorithm means a computer program written in a well defined programming language to carry out the steps of the algorithm.

5 Problem: compute the first n prime numbers. In question 1 you implemented a simple algorithm Let’s discuss possible improvements to make it more efficient In particular, do we need the loop in isPrime to run up to n?


Download ppt "Lecture 14 Go over midterm results Algorithms Efficiency More on prime numbers."

Similar presentations


Ads by Google