This preview shows pages 1–8. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Computer Science Department University of Central Florida Algorithm Analysis COP 3502 Computer Science I Algorithm Analysis page 2 Order Analysis Judging the Efficiency/Speed of an Algorithm Thus far, weve looked at a few different algorithms: Max # of 1s Linear Search vs Binary Search Sorted List Matching Problem and others But we havent really examined them, in detail, regarding their efficiency or speed This is one of the main goals of this class! Algorithm Analysis page 3 Order Analysis Judging the Efficiency/Speed of an Algorithm We will use Order Notation to approximate two things about algorithms: 1) How much time they take 2) How much memory (space) they use Note: It is nearly impossible to figure out the exact amount of time an algorithm will take Each algorithm gets translated into smaller and smaller machine instructions Each of these instructions take various amounts of time to execute on different computers Algorithm Analysis page 4 Order Analysis Judging the Efficiency/Speed of an Algorithm Note: Also, we want to judge algorithms independent of their implementation Thus, rather than figure out an algorithms exact running time We only want an approximation (BigO approximation) Assumptions: we assume that each statement and each comparison in C takes some constant amount of time Also, most algorithms have some type of input With sorting, for example, the size of the input (typically referred to as n) is the number of numbers to be sorted Time and space used by an algorithm function of the input Algorithm Analysis page 5 BigO Notation What is Big O? Sounds like a rapper.?. If it were only that simple! Big O comes from BigO Notation In C.S., we want to know how efficient an algorithm ishow fast it is More specificallywe want to know how the performance of an algorithm responds to changes in problem size Algorithm Analysis page 6 BigO Notation What is Big O? The goal is to provide a qualitative insight on the # of operations for a problem size of n elements. And this total # of operations can be described with a mathematical expression in terms of n . This expression is known as BigO The BigO notation is a way of measuring the order of magnitude of a mathematical expression. O(n) means of the order of n Algorithm Analysis page 7 BigO Notation Consider the expression: How fast is this growing? There are three terms: the 4n 2 , the 3n, and the 10 As n gets bigger, which term makes it get larger fastest? Lets look at some values of n and see what happens?...
View
Full
Document
This note was uploaded on 09/21/2011 for the course COP 3330 taught by Professor Staff during the Spring '08 term at University of Central Florida.
 Spring '08
 Staff
 Algorithms

Click to edit the document details