COP3502_17_AlgorithmAnalysis3

# COP3502_17_AlgorithmAnalysis3 - And More Algorithm Analysis...

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

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

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

View Full Document
And More Algorithm Analysis page 2 And More Algorithm Analysis Examples of Analyzing Code: Last time we went over examples of analyzing code We did this in a somewhat naïve manner Just analyzed the code and tried to “trace” what was going on Today: We will do this in a more structured fashion We mentioned that summations are a tool for you to help coming up with a running time of iterative algorithms Today we will look at some of those same code fragments, as well as others, and show you how to use summations to find the Big-O running time
And More Algorithm Analysis page 3 More Algorithm Analysis Example 1: Determine the Big O running time of the following code fragment: We have two for loops They are NOT nested The first runs from k = 1 up to (and including) n/2 The second runs from j = 1 up to (and including) n 2 for (k = 1; k <= n/2; k++) { sum = sum + 5; } for (j = 1; j <= n*n; j++) { delta = delta + 1; }

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

View Full Document
And More Algorithm Analysis page 4
This is the end of the preview. Sign up to access the rest of the document.

## This document was uploaded on 09/21/2011.

### Page1 / 14

COP3502_17_AlgorithmAnalysis3 - And More Algorithm Analysis...

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

View Full Document
Ask a homework question - tutors are online