lec03-algorithmanalysis

lec03-algorithmanalysis - Algorithm An algorithm is a set...

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

View Full Document Right Arrow Icon
Algorithm • An algorithm is a set of instructions to be followed to solve a problem: – there can be more than one solution (more than one algorithm) to solve a given problem, – an algorithm can be implemented using different programming languages on different platforms. • An algorithm must be correct. It should correctly solve the problem. Once we have a correct algorithm for a problem, we have to determine 9/26/2011 CS202 - Fundamentals of Computer Science II 1 the efficiency of that algorithm: – how much time that algorithm requires, – how much space that algorithm requires. • We will focus on: – how to estimate the time required for an algorithm, – how to reduce the time required.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Analysis of Algorithms • We can have different algorithms to solve a given problem: b Which one is the most efficient? b Between given two algorithms, which one is more efficient? Analysis of Algorithms is the area of computer science that provides tools to analyze the efficiency of different methods of solutions. he efficiency of an gorithm nsiders: 9/26/2011 CS202 - Fundamentals of Computer Science II 2 The efficiency of an algorithm considers: – how much time it requires, – how much memory space it requires, – how much disk space and other resources it requires. We will concentrate on the time requirement. • We will try to find the efficiency of algorithms, not their implementations. • An analysis should focus on gross differences in the efficiency of algorithms that are likely to dominate the overall cost of a solution.
Background image of page 2
Analysis of Algorithms (cont.) • How do we compare the time efficiency of two algorithms that solve the same problem? Naïve Approach : Implement these algorithms in a programming language (C++) and run them to compare their time requirements. Comparing the programs (instead of algorithms) has difficulties: ow are the algorithms coded? 9/26/2011 CS202 - Fundamentals of Computer Science II 3 How are the algorithms coded? – Comparing running times means comparing the implementations. – We should not compare implementations, because they are sensitive to programming style that may cloud the issue of which algorithm is inherently more efficient. What computer should we use? – We should compare the efficiency of algorithms independently of a particular computer. What data should the program use? – Any analysis must be independent of specific data.
Background image of page 3

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

View Full DocumentRight Arrow Icon
Analysis of Algorithms (cont.) • When we analyze algorithms, we should employ mathematical techniques that analyze algorithms independently of specific implementations, computers, or data. • To analyze algorithms: 9/26/2011 CS202 - Fundamentals of Computer Science II 4 – First, we start to count the number of significant operations in a particular solution to assess its efficiency.
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/01/2011 for the course CS 202 taught by Professor Amaşlm during the Spring '11 term at Bilkent University.

Page1 / 88

lec03-algorithmanalysis - Algorithm An algorithm is a set...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online