Analysis Metrics. Intro to Algorithm Analysis. Slides. 12. Alg Analysis. 12. Alg Analysis
|
|
- Bartholomew Benson
- 5 years ago
- Views:
Transcription
1 Itro to Algorithm Aalysis Aalysis Metrics Slides. Table of Cotets. Aalysis Metrics 3. Exact Aalysis Rules 4. Simple Summatio 5. Summatio Formulas 6. Order of Magitude 7. Big-O otatio 8. Big-O Theorems 9. Complexity Classes 0. Practical Complexity Classes. Big-O Simple Summatio. Big-O Aalysis Rules 3. Big-O Array Summatio 4. Array Summatio (exact cout) 5. Practical Applicatios 6. Hardware Speedup 7. Algorithm Behavior Program Ruig (Executio) Time Factors Machie Speed (ot just CPU speed) Programmig Laguage ad Implemetatio Compiler Code Geeratio (optimizatio) Iput Data Size Time Complexity of Algorithm umber of executed statemets: T() Fuctio of the size of the iput (termed ) Ruig Time Factor Implicatios Compiler code geeratio & processor speed differeces are too great to be used as a basis for impartial algorithm comparisos. Overall system load may cause icosistet timig results, eve if the same compiler ad hardware are used. Hardware characteristics, such as the amout of physical memory ad the speed of virtual memory, ca domiate timig results. I ay case, those factors are irrelevat to the complexity of the algorithm. Algorithm Aalysis == Complexity Aalysis
2 Exact Aalysis Rules 3 Simple Summatio 4 Whe attemptig a exact time aalysis: Give: for (i = 0; i < -; i++) {. We assume a arbitrary time uit.. Ruig of each of the followig operatios takes time T(): a) assigmet operatios b) I/O operatios c) Boolea operatios d) arithmetic operatios e) fuctio retur 3. Ruig time of a selectio statemet (if, switch) is the time for the coditio evaluatio + the maximum of the ruig times for the idividual clauses i the selectio. 4. Loop executio time is the time for the setup (iitializatio & setup) + the sum, (over the umber of times the is executed), of the body time + time for the check ad update operatios. (Loop setup will iclude the termiatio check o pre-test s.) Always assume that the executes the maximum umber of iteratios possible 5. Ruig time of a fuctio call is T() for setup + the time for ay parameter calculatios + the time required for the executio of the fuctio body. o-executable statemets, (e.g., declaratios), are ot couted. Oly executable statemets are aalyzed. Rules 4 ad a: time before Rules 4 ad a: time o each iter. of outer Outer will execute - times -- this is the exteral sum. Ier will execute i times -- this is the iteral sum. So, the total time T() is give by: For For ease ease of of summatio summatio cout cout repetitios repetitios startig startig at at.. for (j = 0; j < i; j++) { aray[i][j] = 0; for (i = 0; i < -; i++) { Rules 4 & a: time before for (j = 0; j < i; j++) { aray[i][j] = 0; Rules 4 & a: time before Rules 4, c ad d: time 3 o each iteratio of outer T ( ) Summatio from applyig Rule 4 to outer Rules 4, c ad d: time (o each iteratio of ier ) = 3 + Rule a: time o each pass of ier 5 + i= j= Summatio from applyig Rule 4 to ier i 3
3 Summatio Formulas 5 Order of Magitude 6 Let > 0, let A, B, ad C be costats, ad let f ad g be ay fuctios. The: Fuctio Estimatio Give a algorithm that takes time: f() = k = Cf ( k) = C f ( k) ( f ( k) ± g( k)) = f ( k) ± k = k = k = S: factor out costat S: separate summed terms k = g( k) Graphically: ( + ) k = )( + + C = C k = k = k= k = 6 S3: sum of costat S4: sum of k S5: sum of k squared ( ) time f() ^ 5^ The summatio formulas above ca be used to evaluate the expressios obtaied whe aalyzig the complexity of a algorithm: T ( ) = 3 + = 3+ = i= j= ( 5 + 3i) i= 3 () () i i= i= ( )( ) = 3+ 5( ) = + i From aalysis o previous slide. Apply S3 to the ier sum. Apply S ad S to the outer sum. Apply S3 to the first sum, ad apply S4 to the secod sum. Simplify ad combie terms. Algebraically: (iput size) If > 0 the > 00 If > 5 the > 5 Therefore, if > 0 the: f() = < = 5 So 5 forms a upper boud o f() if is 0 or larger (asymptotic boud). I other words, f() does't grow ay faster tha 5 i the log ru.
4 Big-O otatio 7 Big-O Theorems 8 Big-O otatio is used to express the asymptotic growth rate of a fuctio. Formally suppose that f() ad g() are fuctios of. The we say that f() is i O(g()) provided that there are costats C > 0 ad > 0 such that for all > the f() < Cg(). We ofte say that f is big-o of g or that f is i O(g). By the defiitio above, demostratig that a fuctio f is big-o of a fuctio g requires that we fid specific costats C ad for which the iequality holds (ad show that the iequality does, i fact, hold). Example: from the previous slide, if > 0 the f() = < 5 So, by the defiitio above, f() is i O( ). C = 5 = 0 ote that 5 < 9 (for all ), so we could also coclude that f() is O(9 ). Usually, we re iterested i the tightest (smallest) upper boud, so we d prefer 5 to 9. The aalysis give o slide 4 of this chapter is typical of big-o aalysis, ad is somewhat tricky. I order to simplify our work, we state the followig theorems about big-o: Assume that f() is a fuctio of ad that K is a arbitrary costat. Thm : K is O() Thm : A polyomial is O(the term cotaiig the highest power of ) Thm 3: K*f() is O(f()) [i.e., costat coefficiets ca be dropped] Thm 4: I geeral, f() is big-o of the domiat term of f(), where domiat may usually be determied by the followig list: Complexity Classes smaller costats log b () [always log base if o base is show] log b () to higher powers 3 larger costats to the -th power! [ factorial] larger Thm 5: For ay base b, log b () is O(log()).
5 Complexity Classes 9 Practical Complexity Classes 0 Commo Growth Curves Low-order Curves log log log ^ ^ ^ 0^ log 00 (iput size) 0 Observatios (iput size) order & less Algorithms with Order > require FAR more time tha algorithms with Order or less, eve for fairly small iput sizes. For small, there s ot much practical differece betwee Order ad order log. Observatios Eve for moderately small iput sizes, Order algorithms will require FAR more time tha Order log() algorithms. costats of proportioality, (coefficiets & lesser terms), have very little effect for large values of (betwee complexity classes). Large problems with Order > log() caot practically be executed For = 000 (medium problems) algorithms ca still be used
6 Big-O Simple Summatio Big-O Aalysis Rules Recall: for (i = 0; i < -; i++) { Whe attemptig a approximate big-o time aalysis: for (j = 0; j < i; j++) { aray[i][j] = 0; had a total time complexity T() is give by (slide 4): T ( ) + i = i= j= ad that T() reduced to (slide 5): T ( ) = + 3 ow by Theorem : ad the by Theorem 3: 3 T ( ) O ( ) T ( ) O So we d say that the give code fragmet is of order complexity.. We assume a arbitrary time uit.. Ruig of each of the followig type of statemet takes time T(): [omittig the arithmetic operators] a) assigmet statemet b) I/O statemet c) Boolea expressio evaluatio d) fuctio retur 3. Ruig time of a selectio statemet (if, switch) is T() for the coditio evaluatio + the maximum of the ruig times for the idividual clauses i the selectio. 4. Loop executio time is the time for the setup (iitializatio & setup) + the sum, over the umber of times the is executed, of the body time + time for the check ad update operatios. Always assume that the executes the maximum umber of iteratios possible 5. Ruig time of a fuctio call is T() for fuctio setup + the time required for the executio of the fuctio body. Igore idividual Boolea operatios & arithmetic operatios Igore parameter computatios 6. Ruig time of a sequece of statemets is the largest time of ay statemet i the sequece. Of course, this ivolved some uecessary work. Big-O aalysis provides a gross idicatio of the complexity of a algorithm, ad that ca be obtaied without first doig a exact aalysis (as we did o slides 4 ad 5 for this code fragmet). idicates chages from the rules for exact aalysis stated earlier.
7 Big-O Array Summatio 3 Array Summatio (exact cout) 4 typedef it raytype[]; void sumito(raytype ray, it ) { it i, j, t; i = 0; // a while (i <= ) { // b (outer ) j = t = 0; // c while (j <= i) { // d (ier ) t = t + ray[j]; // e j++; // f ray[i] = t; // g i++; // h Aalysis will deal with the statemets labeled a.. h; executable statemets oly. Ier Loop: Sum from 0..i (or..i+) of the body. Body Rule 6: Maximum of { coditio, e, f Rule : coditio, e, ad f each take So, the ier body takes time O() ad so the ier is i+ O = O i ( + ) = O( i) j= Outer Loop: Sum from 0.. (or..+) of the body. Body Rule 6: Maximum of { coditio, c, ier, g, h Rule : coditio, c, g, ad h each take time So, the outer body takes time O(i) ad so the outer is ( + )( + ) O + i = O = O i= ( ) Fially by Rule 6, the big-o complexity of the fuctio is the maximum of the outer ad statemet, which is O(); so the fuctio is O( ) = O typedef it raytype[]; void sumito(raytype ray, it ) { it i, j, t; i = 0; // a while (i <= ) { // b (outer ) j = t = 0; // c while (j <= i) { // d (ier ) t = t + ray[j]; // e j++; // f ray[i] = t; // g i++; // h Aalysis will deal with the statemets labeled a.. h; executable statemets oly. Ier Loop: Sum from 0..i (or..i+) of the body. Body Rule 4: Sum of { coditio, e, f Rule : coditio ad f each take time ; e takes time So, the ier body takes time 4 ad so the time for the ier is i + 4 = 4( i + ) j= Outer Loop: Sum from 0.. (or..+) of the body. Body Rule 6: Sum of { coditio, c, ier cod, ier, g, h Rule : coditio, g, ad h each take time ; c takes time So, the outer body takes 4(i+) + 6 or 4i + 0, ad so the outer plus statemet a is ( ) = + + T i= ( + )( + ) ( 4i + 0) = ( + ) = + 6 +
8 Practical Applicatios 5 Hardware Speedup 6 Assume: day 00,000 sec. 0 5 sec. (actually 86, 400) Iput size = 0 6 A computer that executes,000,000 Ist/sec C/C++statemet istructios Algorithm Complexity Class Compariso Order: Order: (0 (0 6 6 )) Istructios 0 0 Istructios 0 0 // secs secsto to ru ru secs secsto to ru ru // days days to to ru ru 0 0 days days to to ru ru Iteral Class Comparisos Order: Order: log log log log Istructios 0 0 (( )) = (( )) (( ))// secs secs to to ru ru 0 0 sec sec to to ru ru Withi complexity classes the differeces betwee algorithms due to costats of proportioality, (coefficiets & lesser terms), are ot sigificat eough to warrat reportig except for certai (high usage) applicatios (e.g., sortig, searchig) Does the fact that hardware is always becomig faster hardware mea that algorithm complexity does t really matter? Suppose we could obtai a machie that was capable of executig 0 times as may istructios per secod (so roughly 0 times faster tha the machie hypothesized o the previous slide). How log would the order algorithm take o this machie with a iput size of 0 6? Order: Order: # istructios: (0 (0 6 6 )) = 0 0 # secods to to ru: ru: 0 0 // = # days days to to ru: ru: // = = Impressed? You should t be. That s still day versus 0 secods if a algorithm of order log() were used. What about 00 times faster hardware?.4 hours.
9 Algorithm Behavior 7 Categories Algorithms must be examied uder differet situatios to correctly determie their efficiecy for accurate comparisos. Best Case Aalysis Assumes the iput, data etc. are arraged i the most advatageous order for the algorithm, i.e. causes the executio of the fewest umber of istructios. E.g., sortig - list is already sorted; searchig - desired item is located at first accessed positio. Worst Case Aalysis Assumes the iput, data etc. are arraged i the most disadvatageous order for the algorithm, i.e. causes the executio of the largest umber of statemets. E.g., sortig - list is i opposite order; searchig - desired item is located at the last accessed positio or is missig. Average Case Aalysis Determies the average of the ruig times over all possible permutatios of the iput data. E.g., searchig - desired item is located at every positio, for each search), or is missig. Caveats Algorithms may have quite differet Orders for the aalysis categories, e.g., O(), O( ), O(log), respectively.
Big-O Analysis. Asymptotics
Big-O Aalysis 1 Defiitio: Suppose that f() ad g() are oegative fuctios of. The we say that f() is O(g()) provided that there are costats C > 0 ad N > 0 such that for all > N, f() Cg(). Big-O expresses
More informationRunning Time. Analysis of Algorithms. Experimental Studies. Limitations of Experiments
Ruig Time Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects. The
More informationRunning Time ( 3.1) Analysis of Algorithms. Experimental Studies. Limitations of Experiments
Ruig Time ( 3.1) Aalysis of Algorithms Iput Algorithm Output A algorithm is a step- by- step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects.
More informationAnalysis of Algorithms
Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Ruig Time Most algorithms trasform iput objects ito output objects. The
More informationPseudocode ( 1.1) Analysis of Algorithms. Primitive Operations. Pseudocode Details. Running Time ( 1.1) Estimating performance
Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Pseudocode ( 1.1) High-level descriptio of a algorithm More structured
More informationData Structures and Algorithms. Analysis of Algorithms
Data Structures ad Algorithms Aalysis of Algorithms Outlie Ruig time Pseudo-code Big-oh otatio Big-theta otatio Big-omega otatio Asymptotic algorithm aalysis Aalysis of Algorithms Iput Algorithm Output
More informationBig-O Analysis. Asymptotics
Big-O Aalysis 1 Defiitio: Suppose that f() ad g() are oegative fuctios of. The we say that f() is O(g()) provided that there are costats C > 0 ad N > 0 such that for all > N, f() Cg(). Big-O expresses
More informationAnalysis of Algorithms
Aalysis of Algorithms Ruig Time of a algorithm Ruig Time Upper Bouds Lower Bouds Examples Mathematical facts Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite
More informationA graphical view of big-o notation. c*g(n) f(n) f(n) = O(g(n))
ca see that time required to search/sort grows with size of We How do space/time eeds of program grow with iput size? iput. time: cout umber of operatios as fuctio of iput Executio size operatio Assigmet:
More informationWhat are we going to learn? CSC Data Structures Analysis of Algorithms. Overview. Algorithm, and Inputs
What are we goig to lear? CSC316-003 Data Structures Aalysis of Algorithms Computer Sciece North Carolia State Uiversity Need to say that some algorithms are better tha others Criteria for evaluatio Structure
More informationAlgorithm. Counting Sort Analysis of Algorithms
Algorithm Coutig Sort Aalysis of Algorithms Assumptios: records Coutig sort Each record cotais keys ad data All keys are i the rage of 1 to k Space The usorted list is stored i A, the sorted list will
More informationCIS 121 Data Structures and Algorithms with Java Fall Big-Oh Notation Tuesday, September 5 (Make-up Friday, September 8)
CIS 11 Data Structures ad Algorithms with Java Fall 017 Big-Oh Notatio Tuesday, September 5 (Make-up Friday, September 8) Learig Goals Review Big-Oh ad lear big/small omega/theta otatios Practice solvig
More informationOutline and Reading. Analysis of Algorithms. Running Time. Experimental Studies. Limitations of Experiments. Theoretical Analysis
Outlie ad Readig Aalysis of Algorithms Iput Algorithm Output Ruig time ( 3.) Pseudo-code ( 3.2) Coutig primitive operatios ( 3.3-3.) Asymptotic otatio ( 3.6) Asymptotic aalysis ( 3.7) Case study Aalysis
More informationLecture Notes 6 Introduction to algorithm analysis CSS 501 Data Structures and Object-Oriented Programming
Lecture Notes 6 Itroductio to algorithm aalysis CSS 501 Data Structures ad Object-Orieted Programmig Readig for this lecture: Carrao, Chapter 10 To be covered i this lecture: Itroductio to algorithm aalysis
More informationRemember, to manage anything, we need to measure it. So, how do we compare two implementations? ArrayBag vs. LinkedBag Which is more efficient?
CS706 Intro to Object Oriented Dev II - Spring 04 Announcements Week 4 Program due Two Weeks! Lab 3-4 required completion this week First web-cat submission Material Evaluation of efficiency Time Analysis
More informationCSC165H1 Worksheet: Tutorial 8 Algorithm analysis (SOLUTIONS)
CSC165H1, Witer 018 Learig Objectives By the ed of this worksheet, you will: Aalyse the ruig time of fuctios cotaiig ested loops. 1. Nested loop variatios. Each of the followig fuctios takes as iput a
More informationHow do we evaluate algorithms?
F2 Readig referece: chapter 2 + slides Algorithm complexity Big O ad big Ω To calculate ruig time Aalysis of recursive Algorithms Next time: Litterature: slides mostly The first Algorithm desig methods:
More informationLecture 5. Counting Sort / Radix Sort
Lecture 5. Coutig Sort / Radix Sort T. H. Corme, C. E. Leiserso ad R. L. Rivest Itroductio to Algorithms, 3rd Editio, MIT Press, 2009 Sugkyukwa Uiversity Hyuseug Choo choo@skku.edu Copyright 2000-2018
More informationUNIT 4C Iteration: Scalability & Big O. Efficiency
UNIT 4C Iteratio: Scalability & Big O 1 Efficiecy A computer program should be totally correct, but it should also execute as quickly as possible (time-efficiecy) use memory wisely (storage-efficiecy)
More informationCopyright 2016 Ramez Elmasri and Shamkant B. Navathe
Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe CHAPTER 18 Strategies for Query Processig Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe Itroductio DBMS techiques to process a query Scaer idetifies
More informationCSE 417: Algorithms and Computational Complexity
Time CSE 47: Algorithms ad Computatioal Readig assigmet Read Chapter of The ALGORITHM Desig Maual Aalysis & Sortig Autum 00 Paul Beame aalysis Problem size Worst-case complexity: max # steps algorithm
More informationHomework 1 Solutions MA 522 Fall 2017
Homework 1 Solutios MA 5 Fall 017 1. Cosider the searchig problem: Iput A sequece of umbers A = [a 1,..., a ] ad a value v. Output A idex i such that v = A[i] or the special value NIL if v does ot appear
More informationA Generalized Set Theoretic Approach for Time and Space Complexity Analysis of Algorithms and Functions
Proceedigs of the 10th WSEAS Iteratioal Coferece o APPLIED MATHEMATICS, Dallas, Texas, USA, November 1-3, 2006 316 A Geeralized Set Theoretic Approach for Time ad Space Complexity Aalysis of Algorithms
More informationCMPT 125 Assignment 2 Solutions
CMPT 25 Assigmet 2 Solutios Questio (20 marks total) a) Let s cosider a iteger array of size 0. (0 marks, each part is 2 marks) it a[0]; I. How would you assig a poiter, called pa, to store the address
More informationCOMP Parallel Computing. PRAM (1): The PRAM model and complexity measures
COMP 633 - Parallel Computig Lecture 2 August 24, 2017 : The PRAM model ad complexity measures 1 First class summary This course is about parallel computig to achieve high-er performace o idividual problems
More informationLecture 1: Introduction and Strassen s Algorithm
5-750: Graduate Algorithms Jauary 7, 08 Lecture : Itroductio ad Strasse s Algorithm Lecturer: Gary Miller Scribe: Robert Parker Itroductio Machie models I this class, we will primarily use the Radom Access
More informationSolution printed. Do not start the test until instructed to do so! CS 2604 Data Structures Midterm Spring, Instructions:
CS 604 Data Structures Midterm Sprig, 00 VIRG INIA POLYTECHNIC INSTITUTE AND STATE U T PROSI M UNI VERSI TY Istructios: Prit your ame i the space provided below. This examiatio is closed book ad closed
More informationCSC 220: Computer Organization Unit 11 Basic Computer Organization and Design
College of Computer ad Iformatio Scieces Departmet of Computer Sciece CSC 220: Computer Orgaizatio Uit 11 Basic Computer Orgaizatio ad Desig 1 For the rest of the semester, we ll focus o computer architecture:
More informationAnalysis of Algorithms
Presetatio for use with the textbook, Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 2015 Aalysis of Algorithms Iput 2015 Goodrich ad Tamassia Algorithm Aalysis of Algorithms
More informationSorting in Linear Time. Data Structures and Algorithms Andrei Bulatov
Sortig i Liear Time Data Structures ad Algorithms Adrei Bulatov Algorithms Sortig i Liear Time 7-2 Compariso Sorts The oly test that all the algorithms we have cosidered so far is compariso The oly iformatio
More informationAlgorithms Chapter 3 Growth of Functions
Algorithms Chapter 3 Growth of Fuctios Istructor: Chig Chi Li 林清池助理教授 chigchi.li@gmail.com Departmet of Computer Sciece ad Egieerig Natioal Taiwa Ocea Uiversity Outlie Asymptotic otatio Stadard otatios
More informationChapter 1. Introduction to Computers and C++ Programming. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 1 Itroductio to Computers ad C++ Programmig Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 1.1 Computer Systems 1.2 Programmig ad Problem Solvig 1.3 Itroductio to C++ 1.4 Testig
More informationChapter 4. Procedural Abstraction and Functions That Return a Value. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 4 Procedural Abstractio ad Fuctios That Retur a Value Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 4.1 Top-Dow Desig 4.2 Predefied Fuctios 4.3 Programmer-Defied Fuctios 4.4
More informationAlgorithm Efficiency
Algorithm Effiiey Exeutig ime Compariso of algorithms to determie whih oe is better approah implemet algorithms & reord exeutio time Problems with this approah there are may tasks ruig ourretly o a omputer
More information6.854J / J Advanced Algorithms Fall 2008
MIT OpeCourseWare http://ocw.mit.edu 6.854J / 18.415J Advaced Algorithms Fall 2008 For iformatio about citig these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. 18.415/6.854 Advaced Algorithms
More informationEE University of Minnesota. Midterm Exam #1. Prof. Matthew O'Keefe TA: Eric Seppanen. Department of Electrical and Computer Engineering
EE 4363 1 Uiversity of Miesota Midterm Exam #1 Prof. Matthew O'Keefe TA: Eric Seppae Departmet of Electrical ad Computer Egieerig Uiversity of Miesota Twi Cities Campus EE 4363 Itroductio to Microprocessors
More informationCS473-Algorithms I. Lecture 2. Asymptotic Notation. CS 473 Lecture 2 1
CS473-Algorithms I Lecture Asymptotic Notatio CS 473 Lecture 1 O-otatio (upper bouds) f() = O(g()) if positive costats c, 0 such that e.g., = O( 3 ) 0 f() cg(), 0 c 3 c c = 1 & 0 = or c = & 0 = 1 Asymptotic
More informationCS 11 C track: lecture 1
CS 11 C track: lecture 1 Prelimiaries Need a CMS cluster accout http://acctreq.cms.caltech.edu/cgi-bi/request.cgi Need to kow UNIX IMSS tutorial liked from track home page Track home page: http://courses.cms.caltech.edu/courses/cs11/material
More informationCIS 121 Data Structures and Algorithms with Java Spring Stacks, Queues, and Heaps Monday, February 18 / Tuesday, February 19
CIS Data Structures ad Algorithms with Java Sprig 09 Stacks, Queues, ad Heaps Moday, February 8 / Tuesday, February 9 Stacks ad Queues Recall the stack ad queue ADTs (abstract data types from lecture.
More informationCOSC 1P03. Ch 7 Recursion. Introduction to Data Structures 8.1
COSC 1P03 Ch 7 Recursio Itroductio to Data Structures 8.1 COSC 1P03 Recursio Recursio I Mathematics factorial Fiboacci umbers defie ifiite set with fiite defiitio I Computer Sciece sytax rules fiite defiitio,
More informationChapter 9. Pointers and Dynamic Arrays. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 9 Poiters ad Dyamic Arrays Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 9.1 Poiters 9.2 Dyamic Arrays Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Slide 9-3
More informationCopyright 2016 Ramez Elmasri and Shamkant B. Navathe
Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe CHAPTER 19 Query Optimizatio Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe Itroductio Query optimizatio Coducted by a query optimizer i a DBMS Goal:
More informationthe beginning of the program in order for it to work correctly. Similarly, a Confirm
I our sytax, a Assume statemet will be used to record what must be true at the begiig of the program i order for it to work correctly. Similarly, a Cofirm statemet is used to record what should be true
More informationComputers and Scientific Thinking
Computers ad Scietific Thikig David Reed, Creighto Uiversity Chapter 15 JavaScript Strigs 1 Strigs as Objects so far, your iteractive Web pages have maipulated strigs i simple ways use text box to iput
More informationChapter 3. More Flow of Control. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 3 More Flow of Cotrol Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 3.1 Usig Boolea Expressios 3.2 Multiway Braches 3.3 More about C++ Loop Statemets 3.4 Desigig Loops Copyright
More informationChapter 5. Functions for All Subtasks. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 5 Fuctios for All Subtasks Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 5.1 void Fuctios 5.2 Call-By-Referece Parameters 5.3 Usig Procedural Abstractio 5.4 Testig ad Debuggig
More informationDesigning a learning system
CS 75 Itro to Machie Learig Lecture Desigig a learig system Milos Hauskrecht milos@pitt.edu 539 Seott Square, -5 people.cs.pitt.edu/~milos/courses/cs75/ Admiistrivia No homework assigmet this week Please
More informationHeaps. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015
Presetatio for use with the textbook Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 201 Heaps 201 Goodrich ad Tamassia xkcd. http://xkcd.com/83/. Tree. Used with permissio uder
More information2. ALGORITHM ANALYSIS
2. ALGORITHM ANALYSIS computatioal tractability survey of commo ruig times 2. ALGORITHM ANALYSIS computatioal tractability survey of commo ruig times Lecture slides by Kevi Waye Copyright 2005 Pearso-Addiso
More informationDesigning a learning system
CS 75 Machie Learig Lecture Desigig a learig system Milos Hauskrecht milos@cs.pitt.edu 539 Seott Square, x-5 people.cs.pitt.edu/~milos/courses/cs75/ Admiistrivia No homework assigmet this week Please try
More informationExact Minimum Lower Bound Algorithm for Traveling Salesman Problem
Exact Miimum Lower Boud Algorithm for Travelig Salesma Problem Mohamed Eleiche GeoTiba Systems mohamed.eleiche@gmail.com Abstract The miimum-travel-cost algorithm is a dyamic programmig algorithm to compute
More informationComputer Science Foundation Exam. August 12, Computer Science. Section 1A. No Calculators! KEY. Solutions and Grading Criteria.
Computer Sciece Foudatio Exam August, 005 Computer Sciece Sectio A No Calculators! Name: SSN: KEY Solutios ad Gradig Criteria Score: 50 I this sectio of the exam, there are four (4) problems. You must
More informationElementary Educational Computer
Chapter 5 Elemetary Educatioal Computer. Geeral structure of the Elemetary Educatioal Computer (EEC) The EEC coforms to the 5 uits structure defied by vo Neuma's model (.) All uits are preseted i a simplified
More informationCS200: Hash Tables. Prichard Ch CS200 - Hash Tables 1
CS200: Hash Tables Prichard Ch. 13.2 CS200 - Hash Tables 1 Table Implemetatios: average cases Search Add Remove Sorted array-based Usorted array-based Balaced Search Trees O(log ) O() O() O() O(1) O()
More informationOnes Assignment Method for Solving Traveling Salesman Problem
Joural of mathematics ad computer sciece 0 (0), 58-65 Oes Assigmet Method for Solvig Travelig Salesma Problem Hadi Basirzadeh Departmet of Mathematics, Shahid Chamra Uiversity, Ahvaz, Ira Article history:
More informationcondition w i B i S maximum u i
ecture 10 Dyamic Programmig 10.1 Kapsack Problem November 1, 2004 ecturer: Kamal Jai Notes: Tobias Holgers We are give a set of items U = {a 1, a 2,..., a }. Each item has a weight w i Z + ad a utility
More informationCSE 2320 Notes 8: Sorting. (Last updated 10/3/18 7:16 PM) Idea: Take an unsorted (sub)array and partition into two subarrays such that.
CSE Notes 8: Sortig (Last updated //8 7:6 PM) CLRS 7.-7., 9., 8.-8. 8.A. QUICKSORT Cocepts Idea: Take a usorted (sub)array ad partitio ito two subarrays such that p q r x y z x y y z Pivot Customarily,
More informationCS : Programming for Non-Majors, Summer 2007 Programming Project #3: Two Little Calculations Due by 12:00pm (noon) Wednesday June
CS 1313 010: Programmig for No-Majors, Summer 2007 Programmig Project #3: Two Little Calculatios Due by 12:00pm (oo) Wedesday Jue 27 2007 This third assigmet will give you experiece writig programs that
More informationPython Programming: An Introduction to Computer Science
Pytho Programmig: A Itroductio to Computer Sciece Chapter 1 Computers ad Programs 1 Objectives To uderstad the respective roles of hardware ad software i a computig system. To lear what computer scietists
More informationCivil Engineering Computation
Civil Egieerig Computatio Fidig Roots of No-Liear Equatios March 14, 1945 World War II The R.A.F. first operatioal use of the Grad Slam bomb, Bielefeld, Germay. Cotets 2 Root basics Excel solver Newto-Raphso
More information9.1. Sequences and Series. Sequences. What you should learn. Why you should learn it. Definition of Sequence
_9.qxd // : AM Page Chapter 9 Sequeces, Series, ad Probability 9. Sequeces ad Series What you should lear Use sequece otatio to write the terms of sequeces. Use factorial otatio. Use summatio otatio to
More informationPerformance Plus Software Parameter Definitions
Performace Plus+ Software Parameter Defiitios/ Performace Plus Software Parameter Defiitios Chapma Techical Note-TG-5 paramete.doc ev-0-03 Performace Plus+ Software Parameter Defiitios/2 Backgroud ad Defiitios
More informationBACHMANN-LANDAU NOTATIONS. Lecturer: Dr. Jomar F. Rabajante IMSP, UPLB MATH 174: Numerical Analysis I 1 st Sem AY
BACHMANN-LANDAU NOTATIONS Lecturer: Dr. Jomar F. Rabajate IMSP, UPLB MATH 174: Numerical Aalysis I 1 st Sem AY 018-019 RANKING OF FUNCTIONS Name Big-Oh Eamples Costat O(1 10 Logarithmic O(log log, log(
More informationCIS 121 Data Structures and Algorithms with Java Spring Stacks and Queues Monday, February 12 / Tuesday, February 13
CIS Data Structures ad Algorithms with Java Sprig 08 Stacks ad Queues Moday, February / Tuesday, February Learig Goals Durig this lab, you will: Review stacks ad queues. Lear amortized ruig time aalysis
More informationPolynomial Functions and Models. Learning Objectives. Polynomials. P (x) = a n x n + a n 1 x n a 1 x + a 0, a n 0
Polyomial Fuctios ad Models 1 Learig Objectives 1. Idetify polyomial fuctios ad their degree 2. Graph polyomial fuctios usig trasformatios 3. Idetify the real zeros of a polyomial fuctio ad their multiplicity
More informationClasses and Objects. Again: Distance between points within the first quadrant. José Valente de Oliveira 4-1
Classes ad Objects jvo@ualg.pt José Valete de Oliveira 4-1 Agai: Distace betwee poits withi the first quadrat Sample iput Sample output 1 1 3 4 2 jvo@ualg.pt José Valete de Oliveira 4-2 1 The simplest
More informationUniversity of Waterloo Department of Electrical and Computer Engineering ECE 250 Algorithms and Data Structures
Uiversity of Waterloo Departmet of Electrical ad Computer Egieerig ECE 250 Algorithms ad Data Structures Midterm Examiatio ( pages) Istructor: Douglas Harder February 7, 2004 7:30-9:00 Name (last, first)
More information. Written in factored form it is easy to see that the roots are 2, 2, i,
CMPS A Itroductio to Programmig Programmig Assigmet 4 I this assigmet you will write a java program that determies the real roots of a polyomial that lie withi a specified rage. Recall that the roots (or
More informationData Structures Week #9. Sorting
Data Structures Week #9 Sortig Outlie Motivatio Types of Sortig Elemetary (O( 2 )) Sortig Techiques Other (O(*log())) Sortig Techiques 21.Aralık.2010 Boraha Tümer, Ph.D. 2 Sortig 21.Aralık.2010 Boraha
More informationCS 111 Green: Program Design I Lecture 27: Speed (cont.); parting thoughts
CS 111 Gree: Program Desig I Lecture 27: Speed (cot.); partig thoughts By Nascarkig - Ow work, CC BY-SA 4.0, https://commos.wikimedia.org/w/idex.php?curid=38671041 Robert H. Sloa (CS) & Rachel Poretsky
More informationGC05: Algorithmic Complexity & Computability
GC05: Algorithmic Complexity & Computability This part of the course deals with assessig the time-demad of algorithmic procedures with the aim, where possible, of fidig efficiet solutios to problems. We
More informationn n B. How many subsets of C are there of cardinality n. We are selecting elements for such a
4. [10] Usig a combiatorial argumet, prove that for 1: = 0 = Let A ad B be disjoit sets of cardiality each ad C = A B. How may subsets of C are there of cardiality. We are selectig elemets for such a subset
More informationChapter 8. Strings and Vectors. Copyright 2014 Pearson Addison-Wesley. All rights reserved.
Chapter 8 Strigs ad Vectors Overview 8.1 A Array Type for Strigs 8.2 The Stadard strig Class 8.3 Vectors Slide 8-3 8.1 A Array Type for Strigs A Array Type for Strigs C-strigs ca be used to represet strigs
More informationChapter 11. Friends, Overloaded Operators, and Arrays in Classes. Copyright 2014 Pearson Addison-Wesley. All rights reserved.
Chapter 11 Frieds, Overloaded Operators, ad Arrays i Classes Copyright 2014 Pearso Addiso-Wesley. All rights reserved. Overview 11.1 Fried Fuctios 11.2 Overloadig Operators 11.3 Arrays ad Classes 11.4
More informationPython Programming: An Introduction to Computer Science
Pytho Programmig: A Itroductio to Computer Sciece Chapter 6 Defiig Fuctios Pytho Programmig, 2/e 1 Objectives To uderstad why programmers divide programs up ito sets of cooperatig fuctios. To be able to
More informationarxiv: v2 [cs.ds] 24 Mar 2018
Similar Elemets ad Metric Labelig o Complete Graphs arxiv:1803.08037v [cs.ds] 4 Mar 018 Pedro F. Felzeszwalb Brow Uiversity Providece, RI, USA pff@brow.edu March 8, 018 We cosider a problem that ivolves
More informationAnalysis of Server Resource Consumption of Meteorological Satellite Application System Based on Contour Curve
Advaces i Computer, Sigals ad Systems (2018) 2: 19-25 Clausius Scietific Press, Caada Aalysis of Server Resource Cosumptio of Meteorological Satellite Applicatio System Based o Cotour Curve Xiagag Zhao
More informationSAMPLE VERSUS POPULATION. Population - consists of all possible measurements that can be made on a particular item or procedure.
SAMPLE VERSUS POPULATION Populatio - cosists of all possible measuremets that ca be made o a particular item or procedure. Ofte a populatio has a ifiite umber of data elemets Geerally expese to determie
More informationCOP4020 Programming Languages. Compilers and Interpreters Prof. Robert van Engelen
COP4020 mig Laguages Compilers ad Iterpreters Prof. Robert va Egele Overview Commo compiler ad iterpreter cofiguratios Virtual machies Itegrated developmet eviromets Compiler phases Lexical aalysis Sytax
More informationECE4050 Data Structures and Algorithms. Lecture 6: Searching
ECE4050 Data Structures ad Algorithms Lecture 6: Searchig 1 Search Give: Distict keys k 1, k 2,, k ad collectio L of records of the form (k 1, I 1 ), (k 2, I 2 ),, (k, I ) where I j is the iformatio associated
More informationCh 9.3 Geometric Sequences and Series Lessons
Ch 9.3 Geometric Sequeces ad Series Lessos SKILLS OBJECTIVES Recogize a geometric sequece. Fid the geeral, th term of a geometric sequece. Evaluate a fiite geometric series. Evaluate a ifiite geometric
More informationLower Bounds for Sorting
Liear Sortig Topics Covered: Lower Bouds for Sortig Coutig Sort Radix Sort Bucket Sort Lower Bouds for Sortig Compariso vs. o-compariso sortig Decisio tree model Worst case lower boud Compariso Sortig
More informationAbstract. Chapter 4 Computation. Overview 8/13/18. Bjarne Stroustrup Note:
Chapter 4 Computatio Bjare Stroustrup www.stroustrup.com/programmig Abstract Today, I ll preset the basics of computatio. I particular, we ll discuss expressios, how to iterate over a series of values
More informationChapter 2. C++ Basics. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 2 C++ Basics Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 2.1 Variables ad Assigmets 2.2 Iput ad Output 2.3 Data Types ad Expressios 2.4 Simple Flow of Cotrol 2.5 Program
More informationAn (or ) is a sequence in which each term after the first differs from the preceding term by a fixed constant, called the.
Sectio.2 Arithmetic Sequeces ad Series -.2 Arithmetic Sequeces ad Series Arithmetic Sequeces Arithmetic Series Key Terms: arithmetic sequece (arithmetic progressio), commo differece, arithmetic series
More informationCOMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. Chapter 4. The Processor. Part A Datapath Design
COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Iterface 5 th Editio Chapter The Processor Part A path Desig Itroductio CPU performace factors Istructio cout Determied by ISA ad compiler. CPI ad
More informationChapter 3 Classification of FFT Processor Algorithms
Chapter Classificatio of FFT Processor Algorithms The computatioal complexity of the Discrete Fourier trasform (DFT) is very high. It requires () 2 complex multiplicatios ad () complex additios [5]. As
More informationRecursion. Computer Science S-111 Harvard University David G. Sullivan, Ph.D. Review: Method Frames
Uit 4, Part 3 Recursio Computer Sciece S-111 Harvard Uiversity David G. Sulliva, Ph.D. Review: Method Frames Whe you make a method call, the Java rutime sets aside a block of memory kow as the frame of
More informationCOP4020 Programming Languages. Subroutines and Parameter Passing Prof. Robert van Engelen
COP4020 Programmig Laguages Subrouties ad Parameter Passig Prof. Robert va Egele Overview Parameter passig modes Subroutie closures as parameters Special-purpose parameters Fuctio returs COP4020 Fall 2016
More information1 Graph Sparsfication
CME 305: Discrete Mathematics ad Algorithms 1 Graph Sparsficatio I this sectio we discuss the approximatio of a graph G(V, E) by a sparse graph H(V, F ) o the same vertex set. I particular, we cosider
More informationn Some thoughts on software development n The idea of a calculator n Using a grammar n Expression evaluation n Program organization n Analysis
Overview Chapter 6 Writig a Program Bjare Stroustrup Some thoughts o software developmet The idea of a calculator Usig a grammar Expressio evaluatio Program orgaizatio www.stroustrup.com/programmig 3 Buildig
More informationAn Improved Shuffled Frog-Leaping Algorithm for Knapsack Problem
A Improved Shuffled Frog-Leapig Algorithm for Kapsack Problem Zhoufag Li, Ya Zhou, ad Peg Cheg School of Iformatio Sciece ad Egieerig Hea Uiversity of Techology ZhegZhou, Chia lzhf1978@126.com Abstract.
More informationChapter 8. Strings and Vectors. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 8 Strigs ad Vectors Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 8.1 A Array Type for Strigs 8.2 The Stadard strig Class 8.3 Vectors Copyright 2015 Pearso Educatio, Ltd..
More informationCOP4020 Programming Languages. Functional Programming Prof. Robert van Engelen
COP4020 Programmig Laguages Fuctioal Programmig Prof. Robert va Egele Overview What is fuctioal programmig? Historical origis of fuctioal programmig Fuctioal programmig today Cocepts of fuctioal programmig
More informationCS 683: Advanced Design and Analysis of Algorithms
CS 683: Advaced Desig ad Aalysis of Algorithms Lecture 6, February 1, 2008 Lecturer: Joh Hopcroft Scribes: Shaomei Wu, Etha Feldma February 7, 2008 1 Threshold for k CNF Satisfiability I the previous lecture,
More informationThe golden search method: Question 1
1. Golde Sectio Search for the Mode of a Fuctio The golde search method: Questio 1 Suppose the last pair of poits at which we have a fuctio evaluatio is x(), y(). The accordig to the method, If f(x())
More informationCSE 111 Bio: Program Design I Class 11: loops
SE 111 Bio: Program Desig I lass 11: loops Radall Muroe, xkcd.com/1411/ Robert H. Sloa (S) & Rachel Poretsky (Bio) Uiversity of Illiois, hicago October 2, 2016 Pytho ets Loopy! he Pytho, Busch ardes Florida
More informationChapter 24. Sorting. Objectives. 1. To study and analyze time efficiency of various sorting algorithms
Chapter 4 Sortig 1 Objectives 1. o study ad aalyze time efficiecy of various sortig algorithms 4. 4.7.. o desig, implemet, ad aalyze bubble sort 4.. 3. o desig, implemet, ad aalyze merge sort 4.3. 4. o
More informationBezier curves. Figure 2 shows cubic Bezier curves for various control points. In a Bezier curve, only
Edited: Yeh-Liag Hsu (998--; recommeded: Yeh-Liag Hsu (--9; last updated: Yeh-Liag Hsu (9--7. Note: This is the course material for ME55 Geometric modelig ad computer graphics, Yua Ze Uiversity. art of
More informationRandom Graphs and Complex Networks T
Radom Graphs ad Complex Networks T-79.7003 Charalampos E. Tsourakakis Aalto Uiversity Lecture 3 7 September 013 Aoucemet Homework 1 is out, due i two weeks from ow. Exercises: Probabilistic iequalities
More information