DOC PREVIEW
MSU CSE 830 - Lecture01

This preview shows page 1-2-3-22-23-24-45-46-47 out of 47 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 47 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 47 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 47 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 47 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 47 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 47 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 47 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 47 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 47 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 47 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CSE 830: Design and Theory of AlgorithmsOutlineWhat is an Algorithm?What is a problem?Types of ProblemsTwo desired properties of algorithmsCorrectnessEfficiencySlide 9Course ObjectivesClassic AlgorithmsAlgorithm design methodsAlgorithm correctnessAnalyzing algorithmsProving hardness resultsClear WritingSlide 17Algorithm Analysis OverviewThe RAM ModelInput SizeSlide 21Measuring Complexity3 different analysesAverage case analysisBest, Worst, and Average CaseWorst case analysisSlide 27Motivation for Asymptotic AnalysisSimplificationsWhy ignore constants?Asymptotic Analysis“Big Oh” NotationSet Notation CommentThree Common SetsO(g(n))(g(n))(g(n))O(f(n)) and (g(n))Example FunctionQuick QuestionsCommon Complexity FunctionsExample ProblemsExtra SlidesPossible Algorithm: Nearest neighborNot Correct!A Correct AlgorithmCase study: Insertion SortCSE 830:Design and Theory of AlgorithmsDr. Eric TorngTA: Carl BussemaMany slides adapted from those used by Dr. Charles OfriaOutline•Definitions–Algorithms–Problems•Course Objectives•Administrative stuff …•Analysis of AlgorithmsWhat is an Algorithm?Algorithms are the ideas behind computer programs. An algorithm is the thing that stays the same whether the program is in C++ running on a Cray in New York or is in BASIC running on a Macintosh in Alaska! To be interesting, an algorithm has to solve a general, specified problem.What is a problem?•Definition–A mapping/relation between a set of input instances (domain) and an output set (range)•Problem Specification–Specify what a typical input instance is–Specify what the output should be in terms of the input instance•Example: Sorting–Input: A sequence of N numbers a1…an–Output: the permutation (reordering) of the input sequence such that a1  a2  …  an .Types of ProblemsSearch: find X in the input satisfying property YStructuring: Transform input X to satisfy property YConstruction: Build X satisfying YOptimization: Find the best X satisfying property YDecision: Does X satisfy Y?Adaptive: Maintain property Y over time.Two desired properties of algorithms•Correctness–Always provides correct output when presented with legal input•Efficiency–Computes correct output quickly given inputCorrectness•Example: Traveling Salesperson Problem (TSP)•Input: A sequence of N cities with the distances dij between each pair of cities•Output: a permutation (ordering) of the cities <c1’, …, cn’> that minimizes the expression Σj =1 to n-1 dj’,j’+1 + dn’,1’ •Which of the following algorithms is correct?–Nearest neighbor: Initialize tour to city 1. Extend tour by visiting nearest unvisited city. Finally return to city 1.–All tours: Try all possible orderings of the points selecting the ordering that minimizes the total length:Efficiency•Example: Odd Number Problem•Input: A number n•Output: Yes if n is odd, no if n is even•Which of the following algorithms is most efficient?–Count up to that number from one and alternate naming each number as odd or even.–Factor the number and see if there are any twos in the factorization.–Keep a lookup table of all numbers from 0 to the maximum integer.–Look at the last bit (or digit) of the number.Outline•Definitions–Algorithms–Problems•Course Objectives•Administrative stuff …•Analysis of AlgorithmsCourse Objectives1. Details of classic algorithms2. Methods for designing algorithms3. Validate/verify algorithm correctness4. Analyze algorithm efficiency5. Prove (or at least indicate) no correct, efficient algorithm exists for solving a given problem6. Writing clear algorithms and proofsClassic Algorithms•Lots of wonderful algorithms have already been developed•I expect you to learn most of this from reading, though we will reinforce in lectureAlgorithm design methods•Something of an art form•Cannot be fully automated•We will describe some general techniques and try to illustrate when each is appropriateAlgorithm correctness•Proving an algorithm generates correct output for all inputs•One technique covered in textbook–Loop invariants•We will do some of this in the course, but it is not emphasized as much as other objectivesAnalyzing algorithms•The “process” of determining how much resources (time, space) are used by a given algorithm•We want to be able to make quantitative assessments about the value (goodness) of one algorithm compared to another•We want to do this WITHOUT implementing and running an executable version of an algorithmProving hardness results•We believe that no correct and efficient algorithm exists that solves many problems such as TSP•We define a formal notion of a problem being hard•We develop techniques for proving hardness resultsClear Writing•Methods for Expressing Algorithms–Implementations–Pseudo-code–English•Writing clear and understandable proofs•My main concern is not the specific language used but the clarity of your algorithm/proofOutline•Definitions–Algorithms–Problems•Course Objectives•Administrative stuff …•Analysis of AlgorithmsAlgorithm Analysis Overview•RAM model of computation•Concept of input size•Measuring complexity–Best-case, average-case, worst-case•Asymptotic analysis–Asymptotic notationThe RAM Model•RAM model represents a “generic” implementation of the algorithm•Each “simple” operation (+, -, =, if, call) takes exactly 1 step.•Loops and subroutine calls are not simple operations, but depend upon the size of the data and the contents of a subroutine. We do not want “sort” to be a single step operation.•Each memory access takes exactly 1 step.Input Size•In general, larger input instances require more resources to process correctly•We standardize by defining a notion of size for an input instance•Examples–What is the size of a sorting input instance?–What is the size of an “Odd number” input instance?Algorithm Analysis Overview•RAM model of computation•Concept of input size•Measuring complexity–Best-case, average-case, worst-case•Asymptotic analysis–Asymptotic notationMeasuring Complexity•The running time of an algorithm is the function defined by the number of steps (or amount of memory) required to solve input instances of size n–F(1) = 3–F(2) = 5–F(3) = 7–…–F(n) = 2n+1•Problem: Inputs of the same size may require different numbers of steps to solve3 different analyses•The worst case running


View Full Document

MSU CSE 830 - Lecture01

Download Lecture01
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture01 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture01 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?