The need for speed. Aren’t today’s computers fast enough? Justification for Better Performance complex applications text  graphics  video real-time.

Slides:



Advertisements
Similar presentations
College of Information Technology & Design
Advertisements

Chapter 3 Brute Force Brute force is a straightforward approach to solving a problem, usually directly based on the problem’s statement and definitions.
Introduction to Computer Science Theory
Garfield AP Computer Science
Introduction to Algorithms Rabie A. Ramadan rabieramadan.org 2 Some of the sides are exported from different sources.
Fundamentals of Python: From First Programs Through Data Structures
Complexity Theory  Complexity theory is a problem can be solved? Given: ◦ Limited resources: processor time and memory space.
the fourth iteration of this loop is shown here
Algorithmic Complexity Nelson Padua-Perez Bill Pugh Department of Computer Science University of Maryland, College Park.
Sorting and Searching. Searching List of numbers (5, 9, 2, 6, 3, 4, 8) Find 3 and tell me where it was.
CS107 Introduction to Computer Science
Cmpt-225 Algorithm Efficiency.
Concept of Basic Time Complexity Problem size (Input size) Time complexity analysis.
CS107 Introduction to Computer Science Lecture 7, 8 An Introduction to Algorithms: Efficiency of algorithms.
Algorithmic Complexity Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
CHAPTER 7: SORTING & SEARCHING Introduction to Computer Science Using Ruby (c) Ophir Frieder at al 2012.
Algorithm Analysis (Big O)
Algorithm Analysis Dr. Bernard Chen Ph.D. University of Central Arkansas.
February 17, 2015Applied Discrete Mathematics Week 3: Algorithms 1 Double Summations Table 2 in 4 th Edition: Section th Edition: Section th.
Counting the Cost Recall linear search & binary search Number of items Worst CaseExpected Case Number of probes (comparisons) LinearBinary Linear Binary.
Data Structures Mohamed Mustaq Ahmed Chapter 2- Algorithms.
Array operations II manipulating arrays and measuring performance.
1 Chapter 24 Developing Efficient Algorithms. 2 Executing Time Suppose two algorithms perform the same task such as search (linear search vs. binary search)
{ CS203 Lecture 7 John Hurley Cal State LA. 2 Execution Time Suppose two algorithms perform the same task such as search (linear search vs. binary search)
DISCRETE MATHEMATICS I CHAPTER 11 Dr. Adam Anthony Spring 2011 Some material adapted from lecture notes provided by Dr. Chungsim Han and Dr. Sam Lomonaco.
Analysis of Algorithms
Chapter 19: Searching and Sorting Algorithms
C++ Programming: From Problem Analysis to Program Design, Second Edition Chapter 19: Searching and Sorting.
Unsolvability and Infeasibility. Computability (Solvable) A problem is computable if it is possible to write a computer program to solve it. Can all problems.
Department of Computer Science 1 COSC 2320 Section Room 104 AH 5:30 – 7:00 PM TTh Professor Olin Johnson Office 596 PGH
Analysis of Algorithms CSCI Previous Evaluations of Programs Correctness – does the algorithm do what it is supposed to do? Generality – does it.
Sorting – Insertion and Selection. Sorting Arranging data into ascending or descending order Influences the speed and complexity of algorithms that use.
MA/CSSE 473 Day 23 Student questions Space-time tradeoffs Hash tables review String search algorithms intro.
Computer Science and Software Engineering University of Wisconsin - Platteville 8. Comparison of Algorithms Yan Shi CS/SE 2630 Lecture Notes Part of this.
Algorithm Analysis Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
3 – SIMPLE SORTING ALGORITHMS
CS 206 Introduction to Computer Science II 09 / 18 / 2009 Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 01 / 30 / 2009 Instructor: Michael Eckmann.
New Mexico Computer Science For All Search Algorithms Maureen Psaila-Dombrowski.
Algorithm Analysis (Big O)
27-Jan-16 Analysis of Algorithms. 2 Time and space To analyze an algorithm means: developing a formula for predicting how fast an algorithm is, based.
Searching Topics Sequential Search Binary Search.
Review 1 Merge Sort Merge Sort Algorithm Time Complexity Best case Average case Worst case Examples.
1 Asymptotic Analysis Outline In this topic, we will look at: –Justification for analysis –Quadratic and polynomial growth –Counting machine instructions.
Ch03-Algorithms 1. Algorithms What is an algorithm? An algorithm is a finite set of precise instructions for performing a computation or for solving a.
Chapter 3 Chapter Summary  Algorithms o Example Algorithms searching for an element in a list sorting a list so its elements are in some prescribed.
Section 1.7 Comparing Algorithms: Big-O Analysis.
1 Algorithms Searching and Sorting Algorithm Efficiency.
Algorithm Complexity is concerned about how fast or slow particular algorithm performs.
CSC 108H: Introduction to Computer Programming Summer 2011 Marek Janicki.
Algorithm Analysis 1.
Analysis of Algorithms
COP 3503 FALL 2012 Shayan Javed Lecture 15
Computer Science 112 Fundamentals of Programming II
Performance The need for speed.
Enough Mathematical Appetizers!
Computation.
Adapted from slides by Marty Stepp and Stuart Reges
CS 2210 Discrete Structures Algorithms and Complexity
Performance The need for speed.
Binary Search and Intro to Sorting
Lecture 6 Efficiency of Algorithms (2) (S&G, ch.3)
Comparing Algorithms Unit 1.2.
Applied Discrete Mathematics Week 6: Computation
Performance The need for speed.
Algorithmic Complexity
Searching, Sorting, and Asymptotic Complexity
Binary Search Counting
Design and Analysis of Algorithms
CS 2210 Discrete Structures Algorithms and Complexity
Presentation transcript:

The need for speed

Aren’t today’s computers fast enough? Justification for Better Performance complex applications text  graphics  video real-time applications computational science

How do we create faster computation? 1) Faster Hardware 2) Faster Algorithms

How to achieve Moore’s Law? 1)Miniaturization 3) Different technologies limitations: manufacturing & speed of light optical computers? biological computers? 2) Multiple processors (supercomputers) quantum computers?

Algorithm speed can be estimated by counting...the number of instructions executed...the number of variable/memory assignments...the number of data comparisons A benchmark is a program execution used to measure execution time. (a single experimental result) Benchmarks are one way to analyze algorithms. empirical approach analytic approach How would you know which algorithm is faster?

Counting the Cost Recall linear search & binary search Number of items Worst CaseExpected Case Number of probes (comparisons) LinearBinary Linear Binary NNlog 2 NN/2log 2 N Note that 1000 processors could search 1000 items with a single probe per processor.

Algorithm to find the maximum Consider 8 numbers. abcdefgh max of a & b max of c & d max of e & f max of g & h max of a - d max of e - h max of a - h comparisons Total number of comparisons?

Algorithm to find the maximum What about 7 numbers. abcdefg max of a & b max of c & d max of e & f max of a - d max of e - g max of a - g Total number of comparisons?

Algorithm to find the maximum What about 6 numbers. abcdef max of a & b max of c & d max of e & f max of a - d max of a - f Total number of comparisons?

Algorithm to find the maximum The performance of this algorithm is similar to the linear search. Number of items Number of comparisons NN-1 However, using many processors doesn’t help as much for the maximum finder algorithm.

Sorting Algorithms Sorting algorithms rearrange items from smallest to largest (or largest to smallest). One sorting algorithm: - repeatedly find the maximum and move it immediately ahead of all prior maximums. Example (sort 100 values) Step 1 - find the maximum of 100 values 99 comparisons Step 2 - find the maximum of 99 values 98 comparisons Step 3 - find the maximum of 98 values 97 comparisons Total comparisons for sorting 100: Total comparisons for sorting N: (N-1)+(N-2)+(N-3) = N*(N-1) 2

Comparing Algorithm Performance binary search linear search sorting algorithm

Are there slower algorithms? Consider an algorithm to crack your password. One such algorithm attempts every possible keystroke. Analysis Password lengthComparisons *94 = 8, *94*94 = 830, = 6 x N 94 N......

Comparing Algorithm Performance password cracker other algorithms

Functional Growth x (note 1) (note 2) nlog 2 nn2n2 94 n note 1 - roughly five years of computation for a 1 petaflop supercomputer note 2 - about 5 times the age of the universe linear search binary search sort password cracker not practical for any large number of items

Important Results #1 -- There are algorithms that take too long to be practically executed on a computer. #2 -- These slow algorithms tend of be of the type that attempt a brute force approach of attempting all possible combinations. #3 -- Moore’s Law cannot fix the problem.

So what do we know? Many algorithms can be processed by modern computers. Some algorithms will be processed with faster computers. Computers will never be fast enough for some algorithms.