Cmsc 451 design and analysis of computer
➤ Gửi thông báo lỗi ⚠️ Báo cáo tài liệu vi phạmNội dung chi tiết: Cmsc 451 design and analysis of computer
Cmsc 451 design and analysis of computer
CMSC 451Design and Analysis of Computer Algorithms1David M. Mount Department of Computer Science University of Maryland Fall 2003“Copyright. David M. Cmsc 451 design and analysis of computer Mount. 2OT4. Dept, of Computer Scieocc. University of Maryland. College Park. MD. 20742. These lecture notes ’.sere prepared by David Mount for the court* CMSC 451. De»:gn and Analysis of Computer Aljorithnii, at the University of Maryland Pcnniswon to use. copy. modify, and distribute these notes Cmsc 451 design and analysis of computer for educational purposes and without fee IS hereby granted, provided that this copyright notice appear in all copies.Lecture Notes1CMSC451EstablishingCmsc 451 design and analysis of computer
efficiency is a much more complex endeavor Intuitively, an algorithm's efficiency IS a function of the amount of computational resources It requires,CMSC 451Design and Analysis of Computer Algorithms1David M. Mount Department of Computer Science University of Maryland Fall 2003“Copyright. David M. Cmsc 451 design and analysis of computer lex function of the size and structure of the input set. In order to reduce matters to their simplest form, it is common to consider efficiency as a function of input size Among all inputs of the same size, we consider the maximum possible running tunc Tills is calledanalysis. It 15 also possible, a Cmsc 451 design and analysis of computer nd often more meaningful, to measureeragC’Case analysis. Average-case analyses tend to be more complex, and may require that some probability distribuCmsc 451 design and analysis of computer
tion be defined on the set of inputs. To keep matters sunpie. we will usually focus on worst-case analysis in this course.Throughout out this course, CMSC 451Design and Analysis of Computer Algorithms1David M. Mount Department of Computer Science University of Maryland Fall 2003“Copyright. David M. Cmsc 451 design and analysis of computer lgorithm (in pseudo-code, for example). They key here is "keep if simple" Uninteresting details should be kqit to a minimum, so that the key computational issues stand out. (For example, it is not necessary to declare variables whose purpose is obvious, and it is often simpler and clearer to simply Cmsc 451 design and analysis of computer say. “Add X to die end of list than to present code to do this or use some arcane syntax, such as "L.inserrAfEnil(A7).”)•Present a justification or prCmsc 451 design and analysis of computer
oof of the algorithm’s correctness. Yom justification should assume that the reader is someone of similar background as yourself, say another student CMSC 451Design and Analysis of Computer Algorithms1David M. Mount Department of Computer Science University of Maryland Fall 2003“Copyright. David M. Cmsc 451 design and analysis of computer t obvious or trivial elements. A good proof provides an overview of what the algorithm docs, and then focuses on any tncky elements that may not be obvious•Present a worst-case analysis of the algorithms efficiency, typically it running time (but also its space, if space IS an issue). Sometimes this Cmsc 451 design and analysis of computer IS straightforward. but if not. concentrate on the parts of the analysis that arc not obviousNote that the presentation docs not need to be in this oCmsc 451 design and analysis of computer
rder Often It is good to begin with an explanation of how you derived the algorithm, emphasizing particular elements of the design that establish its CMSC 451Design and Analysis of Computer Algorithms1David M. Mount Department of Computer Science University of Maryland Fall 2003“Copyright. David M. Cmsc 451 design and analysis of computer worry. We will sec many examples of this process throughout the semester.Lecture 2: Mathematical BackgroundRead: Review Chapters 1-5 111 CLRSAlgorithm Analysis: Today we will review some of the basic elements of algorithm analysis, winch were covered in previous courses These include asymptotics, s Cmsc 451 design and analysis of computer ummations, and recurrences.Asymptotics: Asymptotics involves O-notation ("big-Oh") and its many relatives. íĩ. H. o (“httlc-Oh”). u». Asymptotic notatCmsc 451 design and analysis of computer
ion provides US with a way to simplify the functions that arise 111 analyzing algorithm runnmg times by ignoring constant factors and concentrating onCMSC 451Design and Analysis of Computer Algorithms1David M. Mount Department of Computer Science University of Maryland Fall 2003“Copyright. David M. Cmsc 451 design and analysis of computer 2n log n 6 0(n3 log n)15n2 4-7nlog3n € ®(«3)3n 4- 4 log- n + 19n* 6 0(na).Thus, the first algorithm is significantly slower for large n. while the other two are comparable, up to a constant factor.Since asymptotics were covered in earlier courses. I will assume that this is familiar to you. Nonethel Cmsc 451 design and analysis of computer ess, here arc a few facts to remember about asymptotic notation:Lecture Notes3CMSC 451Ignore constant factors: Multiplicative constant factors arc IgnCmsc 451 design and analysis of computer
ored For example. 347n 15 0(n). Constant factors appearing exponents cannot be ignored For example. 2s" is nor 0(2").Focus OU large n: Asymptotic analCMSC 451Design and Analysis of Computer Algorithms1David M. Mount Department of Computer Science University of Maryland Fall 2003“Copyright. David M. Cmsc 451 design and analysis of computer mple. 3n2 log n + 2bĩi log n + (logn)7 IS 0(n2logn).Polylog, polynomial, and exponential: These arc the most common functions that arise m analyzing algorithms:Pole logarithmic: Powers of log n. such as (logn)7. We will usually write this as log7 n.Polynomial: Powers of n. such as n1 and v"n = nl/2. Cmsc 451 design and analysis of computer Exponential: A constant (not 1) raised to the power n. such as 3'*.An important fact is that polyiogaiithnuc functions arc strictly asymptotically smaCmsc 451 design and analysis of computer
ller than polynomial function, winch aie strictly asymptotically smaller than exponential functions (assuming the base of the exponent is biggei than CMSC 451Design and Analysis of Computer Algorithms1David M. Mount Department of Computer Science University of Maryland Fall 2003“Copyright. David M. Cmsc 451 design and analysis of computer ation: It is a good idea to first simplify terms involving logarithms. Foi example, the following formulas arc useful. Here a. b, c arc constants:CMSC 451Design and Analysis of Computer Algorithms1David M. Mount Department of Computer Science University of Maryland Fall 2003“Copyright. David M.Gọi ngay
Chat zalo
Facebook