CSCE 411 Design and Analysis of Algorithms Set 1: Introduction and Review Prof. Jennifer Welch Spring 2012 CSCE 411, Spring 2012: Set 1 1.

Slides:



Advertisements
Similar presentations
CMSC 611: Advanced Computer Architecture Performance Some material adapted from Mohamed Younis, UMBC CMSC 611 Spr 2003 course slides Some material adapted.
Advertisements

Introduction to Algorithms 6.046J Lecture 1 Prof. Shafi Goldwasser Prof. Erik Demaine.
Razdan with contribution from others 1 Algorithm Analysis What is the Big ‘O Bout? Anshuman Razdan Div of Computing.
Introductory Lecture. What is Discrete Mathematics? Discrete mathematics is the part of mathematics devoted to the study of discrete (as opposed to continuous)
What is an Algorithm? (And how do we analyze one?)
Algorithmic Complexity Nelson Padua-Perez Bill Pugh Department of Computer Science University of Maryland, College Park.
CS 253: Algorithms Syllabus Chapter 1 Appendix A.
Analysis of Algorithms intro.  What is “goodness”?  How to measure efficiency? ◦ Profiling, Big-Oh  Big-Oh: ◦ Motivation ◦ Informal examples ◦ Informal.
Introduction to Analysis of Algorithms
© 2006 Pearson Addison-Wesley. All rights reserved10-1 Chapter 10 Algorithm Efficiency and Sorting CS102 Sections 51 and 52 Marc Smith and Jim Ten Eyck.
CPSC 411, Fall 2008: Set 1 1 CPSC 411 Design and Analysis of Algorithms Set 1: Introduction and Review Prof. Jennifer Welch Fall 2008.
CSE 830: Design and Theory of Algorithms
CSE 830: Design and Theory of Algorithms
1 Data Structures A program solves a problem. A program solves a problem. A solution consists of: A solution consists of:  a way to organize the data.
CSE 830: Design and Theory of Algorithms Dr. Eric Torng.
CS3381 Des & Anal of Alg ( SemA) City Univ of HK / Dept of CS / Helena Wong 2. Analysis of Algorithms - 1 Analysis.
Lecture 3 Aug 31, 2011 Goals: Chapter 2 (algorithm analysis) Examples: Selection sorting rules for algorithm analysis discussion of lab – permutation generation.
2 -1 Chapter 2 The Complexity of Algorithms and the Lower Bounds of Problems.
1 Efficiency of Algorithms. 2  Two main issues related to the efficiency of algorithms:  Speed of algorithm  Efficient memory allocation  We will.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Instructor: Paul Beame TA: Gidon Shavit.
Lecture 3 Feb 7, 2011 Goals: Chapter 2 (algorithm analysis) Examples: Selection sorting rules for algorithm analysis Image representation Image processing.
Analysis of Algorithms COMP171 Fall Analysis of Algorithms / Slide 2 Introduction * What is Algorithm? n a clearly specified set of simple instructions.
© 2006 Pearson Addison-Wesley. All rights reserved10 A-1 Chapter 10 Algorithm Efficiency and Sorting.
Cmpt-225 Simulation. Application: Simulation Simulation  A technique for modeling the behavior of both natural and human-made systems  Goal Generate.
Analysis of Performance
Instructor Neelima Gupta
CSC 201 Analysis and Design of Algorithms Lecture 03: Introduction to a CSC 201 Analysis and Design of Algorithms Lecture 03: Introduction to a lgorithms.
Introduction CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
Introduction to Algorithms Jiafen Liu Sept
Lecture 2 Computational Complexity
Algorithm Efficiency CS 110: Data Structures and Algorithms First Semester,
Algorithm Input Output An algorithm is a step-by-step procedure for solving a problem in a finite amount of time. Chapter 4. Algorithm Analysis (complexity)
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.
Introduction CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
Fundamentals of Algorithms MCS - 2 Lecture # 1
ECOE 456/556: Algorithms and Computational Complexity Lecture 1 Serdar Taşıran.
Chapter 10 A Algorithm Efficiency. © 2004 Pearson Addison-Wesley. All rights reserved 10 A-2 Determining the Efficiency of Algorithms Analysis of algorithms.
CSE373: Data Structures and Algorithms Lecture 4: Asymptotic Analysis Catie Baker Spring 2015.
Introduction to Algorithms (2 nd edition) by Cormen, Leiserson, Rivest & Stein Chapter 1: The Role of Algorithms in Computing (slides by N. Adlai A. DePano)
Analysis of Algorithms CSCI Previous Evaluations of Programs Correctness – does the algorithm do what it is supposed to do? Generality – does it.
Major objective of this course is: Design and analysis of modern algorithms Different variants Accuracy Efficiency Comparing efficiencies Motivation thinking.
Introduction to Analysis of Algorithms COMP171 Fall 2005.
What is an algorithm? Algorithms are the ideas behind computer programs. An algorithm is the thing which stays the same whether the program is in Pascal.
1Computer Sciences Department. Book: Introduction to Algorithms, by: Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest Clifford Stein Electronic:
Program Efficiency & Complexity Analysis. Algorithm Review An algorithm is a definite procedure for solving a problem in finite number of steps Algorithm.
MS 101: Algorithms Instructor Neelima Gupta
MS 101: Algorithms Instructor Neelima Gupta
Chapter 10 Algorithm Analysis.  Introduction  Generalizing Running Time  Doing a Timing Analysis  Big-Oh Notation  Analyzing Some Simple Programs.
CS 127 Introduction to Computer Science. What is a computer?  “A machine that stores and manipulates information under the control of a changeable program”
Algorithm Analysis Part of slides are borrowed from UST.
CSCE 411 Design and Analysis of Algorithms Set 1: Introduction Slides by Prof. Jennifer Welch Spring 2014 CSCE 411, Spring 2013: Set 1 1.
1/6/20161 CS 3343: Analysis of Algorithms Lecture 2: Asymptotic Notations.
2IS80 Fundamentals of Informatics Fall 2015 Lecture 5: Algorithms.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 23 Algorithm Efficiency.
CS 150: Analysis of Algorithms. Goals for this Unit Begin a focus on data structures and algorithms Understand the nature of the performance of algorithms.
Introduction CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
Onlinedeeneislam.blogspot.com1 Design and Analysis of Algorithms Slide # 1 Download From
1 The Role of Algorithms in Computing. 2 Computational problems A computational problem specifies an input-output relationship  What does the.
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.
GC 211:Data Structures Week 2: Algorithm Analysis Tools Slides are borrowed from Mr. Mohammad Alqahtani.
Introductory Lecture. What is Discrete Mathematics? Discrete mathematics is the part of mathematics devoted to the study of discrete (as opposed to continuous)
Design and Analysis of Algorithms Faculty Name : Ruhi Fatima Course Description This course provides techniques to prove.
Algorithm Efficiency and Sorting
Introduction to Algorithms
Introduction to Algorithms
CSCE 411 Design and Analysis of Algorithms
Objective of This Course
Introduction to Algorithms Analysis
Introduction to Algorithms
DAA - Introduction Dr. Sashikala Mishra Associate Professor Department of Computer Engineering Hope Foundation’s INTERNATIONAL INSTITUTE OF INFORMATION.
Presentation transcript:

CSCE 411 Design and Analysis of Algorithms Set 1: Introduction and Review Prof. Jennifer Welch Spring 2012 CSCE 411, Spring 2012: Set 1 1

Mechanics /411.s11 Piazza for announcements and class discussion: 1 Sources: [CLRS] (textbook) The Algorithm Design Manual, Steven S. Skiena CSCE 411, Spring 2012: Set 12

Introduction What is an algorithm? a step-by-step procedure to solve a problem every program is the instantiation of some algorithm CSCE 411, Spring 2012: Set 13

Sorting Example Solves a general, well-specified problem given a sequence of n keys, a 1,…,a n, as input, produce as output a reordering b 1,…,b n of the keys so that b 1 ≤ b 2 ≤ … ≤ b n. Problem has specific instances [Dopey, Happy, Grumpy] or [3,5,7,1,2,3] Algorithm takes every possible instance and produces output with desired properties insertion sort, quicksort, heapsort, … CSCE 411, Spring 2012: Set 14

Challenge Hard to design algorithms that are correct efficient implementable Need to know about design and modeling techniques resources - don't reinvent the wheel CSCE 411, Spring 2012: Set 15

Correctness How do you know an algorithm is correct? produces the correct output on every input Since there are usually infinitely many inputs, it is not trivial Saying "it's obvious" can be dangerous often one's intuition is tricked by one particular kind of input CSCE 411, Spring 2012: Set 16

Tour Finding Problem Given a set of n points in the plane, what is the shortest tour that visits each point and returns to the beginning? application: robot arm that solders contact points on a circuit board; want to minimize movements of the robot arm How can you find it? CSCE 411, Spring 2012: Set 17

Finding a Tour: Nearest Neighbor start by visiting any point while not all points are visited choose unvisited point closest to last visited point and visit it return to first point CSCE 411, Spring 2012: Set 18

Nearest Neighbor Counter- example CSCE 411, Spring 2012: Set

How to Prove Correctness? There exist formal methods even automated tools more advanced than this course In this course we will primarily rely on more informal reasoning about correctness Seeking counter-examples to proposed algorithms is important part of design process CSCE 411, Spring 2012: Set 110

Efficiency Software is always outstripping hardware need faster CPU, more memory for latest version of popular programs Given a problem: what is an efficient algorithm? what is the most efficient algorithm? does there even exist an algorithm? CSCE 411, Spring 2012: Set 111

How to Measure Efficiency Machine-independent way: analyze "pseudocode" version of algorithm assume idealized machine model one instruction takes one time unit "Big-Oh" notation order of magnitude as problem size increases Worst-case analyses safe, often occurs most often, average case often just as bad CSCE 411, Spring 2012: Set 112

Faster Algorithm vs. Faster CPU A faster algorithm running on a slower machine will always win for large enough instances Suppose algorithm S1 sorts n keys in 2n 2 instructions Suppose computer C1 executes 1 billion instruc/sec When n = 1 million, takes 2000 sec Suppose algorithm S2 sorts n keys in 50nlog 2 n instructions Suppose computer C2 executes 10 million instruc/sec When n = 1 million, takes 100 sec CSCE 411, Spring 2012: Set 113

Caveat No point in finding fastest algorithm for part of the program that is not the bottleneck If program will only be run a few times, or time is not an issue (e.g., run overnight), then no point in finding fastest algorithm CSCE 411, Spring 2012: Set 114

Modeling the Real World Cast your application in terms of well-studied abstract data structures CSCE 411, Spring 2012: Set 115 ConcreteAbstract arrangement, tour, ordering, sequencepermutation cluster, collection, committee, group, packaging, selectionsubsets hierarchy, ancestor/descendants, taxonomytrees network, circuit, web, relationshipgraph sites, positions, locationspoints shapes, regions, boundariespolygons text, characters, patternsstrings

Real-World Applications Hardware design: VLSI chips Compilers Computer graphics: movies, video games Routing messages in the Internet Searching the Web Distributed file sharing Computer aided design and manufacturing Security: e-commerce, voting machines Multimedia: CD player, DVD, MP3, JPG, HDTV DNA sequencing, protein folding CSCE 411, Spring 2012: Set 116

Review of Big-Oh Notation Measure time as a function of input size and ignore multiplicative constants lower order terms f(n) = O(g(n)) f(n) = Ω(g(n)) f(n) =  (g(n)) f(n) = o(g(n)) f(n) =  (g(n)) CSCE 411, Spring 2012: Set 117