{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

COP3502_14_AlgorithmAnalysis1

# COP3502_14_AlgorithmAnalysis1 - Algorithm Analysis Computer...

This preview shows pages 1–9. Sign up to view the full content.

Computer Science Department University of Central Florida Algorithm Analysis COP 3502 – Computer Science I

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Algorithm Analysis page 2 Order Analysis Judging the Efficiency/Speed of an Algorithm Thus far, we’ve looked at a few different algorithms: Max # of 1’s Linear Search vs Binary Search Sorted List Matching Problem and others But we haven’t 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

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
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 algorithm’s exact running time We only want an approximation (Big-O 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 Big-O Notation What is Big O? Sounds like a rapper.?. If it were only that simple! Big O comes from Big-O Notation In C.S., we want to know how efficient an algorithm is…how “fast” it is More specifically…we want to know how the performance of an algorithm responds to changes in problem size

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Algorithm Analysis page 6 Big-O 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 Big-O The Big-O 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 Big-O 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? Let’s look at some values of n and see what happens? 10 3 4 ) ( 2 + + = n n n f n 4n 2 3n 10 1 4 3 10 10 400 30 10 100 40,000 300 10 1000 4,000,000 3,000 10 10,000 400,000,000 30,000 10 100,000 40,000,000,000 300,000 10 1,000,000 4,000,000,000,000 3,000,000 10

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Algorithm Analysis page 8 Big-O Notation Consider the expression: How fast is this “growing”?
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 44

COP3502_14_AlgorithmAnalysis1 - Algorithm Analysis Computer...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online