CPSC 411, Fall 2008: Set 1 1 CPSC 411 Design and Analysis of Algorithms Set 1: Introduction and Review Prof. Jennifer Welch Fall 2008.

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?)
CSC401 – Analysis of Algorithms Lecture Notes 1 Introduction
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
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.
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.
TTIT33 Algorithms and Optimization – Lecture 1 Jan Maluszynski - HT Analysis of Algorithms Introductory Example Principles of Analysis Big-Oh notation.
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.
Analysis of Performance
Instructor Neelima Gupta
HOW TO SOLVE IT? Algorithms. An Algorithm An algorithm is any well-defined (computational) procedure that takes some value, or set of values, as input.
Algorithm Analysis & Complexity We saw that a linear search used n comparisons in the worst case (for an array of size n) and binary search had logn comparisons.
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 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)
1 Computer Algorithms Lecture 3 Asymptotic Notation Some of these slides are courtesy of D. Plaisted, UNC and M. Nicolescu, UNR.
Algorithm Analysis An algorithm is a clearly specified set of simple instructions to be followed to solve a problem. Three questions for algorithm analysis.
Fundamentals of Algorithms MCS - 2 Lecture # 1
Introduction to Algorithms 6.046J/18.401J/SMA5503 Lecture 1 Prof. Charles E. Leiserson.
ECOE 456/556: Algorithms and Computational Complexity Lecture 1 Serdar Taşıran.
1 COMP3040 Tutorial 1 Analysis of algorithms. 2 Outline Motivation Analysis of algorithms Examples Practice questions.
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.
Time Complexity of Algorithms (Asymptotic Notations)
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.
Text Chapters 2 Analyzing Algorithms.  goal: predicting resources that an algorithm requires memory, communication bandwidth, hardware, memory, communication.
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.
Onlinedeeneislam.blogspot.com1 Design and Analysis of Algorithms Slide # 1 Download From
BITS Pilani Pilani Campus Data Structure and Algorithms Design Dr. Maheswari Karthikeyan Lecture1.
CSCE 411 Design and Analysis of Algorithms Set 1: Introduction and Review Prof. Jennifer Welch Spring 2012 CSCE 411, Spring 2012: Set 1 1.
1 Asymptotes: Why? How to describe an algorithm’s running time? (or space, …) How does the running time depend on the input? T(x) = running time for instance.
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.
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
Introduction to Algorithms
Introduction to Algorithms
CSCE 411 Design and Analysis of Algorithms
Objective of This Course
Asst. Dr.Surasak Mungsing
Introduction to Algorithms
Math/CSE 1019N: Discrete Mathematics for Computer Science Winter 2007
Presentation transcript:

CPSC 411, Fall 2008: Set 1 1 CPSC 411 Design and Analysis of Algorithms Set 1: Introduction and Review Prof. Jennifer Welch Fall 2008

CPSC 411, Fall 2008: Set 12 Mechanics ching/411.f08/ ching/411.f08/ Sources: [CLRS] (textbook) The Algorithm Design Manual, Steven S. Skiena

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

CPSC 411, Fall 2008: Set 14 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, …

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

CPSC 411, Fall 2008: Set 16 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

CPSC 411, Fall 2008: Set 17 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?

CPSC 411, Fall 2008: Set 18 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

CPSC 411, Fall 2008: Set 19 Nearest Neighbor Counter- example

CPSC 411, Fall 2008: Set 110 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

CPSC 411, Fall 2008: Set 111 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?

CPSC 411, Fall 2008: Set 112 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

CPSC 411, Fall 2008: Set 113 Faster Algorithm vs. Faster CPU A faster algorithm running on a slower machine will always win for large enough instances S1 sorts n keys in 2n 2 instructions C1 executes 1 billion instructions/sec n = 1 million => 2000 sec S2 sorts n keys in 50nlog 2 n instructions C2 executes 10 million instructions/sec n = 1 million => 100 sec

CPSC 411, Fall 2008: Set 114 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

CPSC 411, Fall 2008: Set 115 Modeling the Real World Cast your application in terms of well-studied abstract data structures 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

CPSC 411, Fall 2008: Set 116 Real-World Applications Hardware design, especially VLSI chips Compilers Routing messages in the Internet Architecture (buildings) Computer aided design and manufacturing Encryption DNA sequencing …

CPSC 411, Fall 2008: Set 117 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))