Department of Informatics Prof. Dr. Michael Böhlen Binzmühlestrasse Zurich Phone:
|
|
- Philomena Sharp
- 5 years ago
- Views:
Transcription
1 Departmet of Iformatics Prof. Dr. Michael Böhle Bizmühlestrasse Zurich Phoe: Iformatik II Midterm1 Sprig Advice You have 90 miutes to complete the exam of Iformatik II. The followig rules apply: Aswer the questios o the exam sheets or the backside. Mark clearly which aswer belogs to which questio. Additioal sheets are provided upo request. If you use additioal sheets, put your ame ad matriculatio umber o each of them. Check the completeess of your exam (13 umbered pages). Use a pe i blue or black colour for your solutios. Pecils ad pes i other colours are ot allowed. Solutios writte i pecil will ot be corrected. Stick to the termiology ad otatios used i the lectures. Oly the followig materials are allowed for the exam: Oe A4 sheet (-sided) with your persoal hadwritte otes, writte by yourself. Sheets that do ot coform to this specificatio will be collected. A foreig laguage dictioary is allowed. The dictioary will be checked by a supervisor. No additioal items are allowed except calculators. Computers, pdas, smart-phoes, audio-devices or similar devices may ot be used. Ay cheatig attempt will result i a failed test (meaig 0 poits). Put your studet legitimatio card ( Legi ) o the desk. Sigature: Correctio slot Please do ot fill out the part below Exercise Total Poits Achieved Maximum Poits
2 Exercise 1 15 Poits Arrays ad Sortig 1.1 [8 poits] Cosider a array of itegers A[0..-1], which cotais all itegers betwee 1 ad +1 except oe. 1. Assume the array is sorted. Fid ad describe a algorithm with subliear (i.e., less tha liear) asymptotic complexity that determies the missig umber. Determie the asymptotic worst-case complexity of your algorithm.. Assume the array is ot sorted. Fid ad describe a algorithm with liear asymptotic complexity that determies the missig umber. Hit: You ca use a auxiliary array. You do ot eed to implemet the algorithm. 1. We use biary search for a sorted array: We look for the smallest idex i for which A[i] = i + ; this is the positio of our missig umber. We fid the mid elemet, mid =. If A[mid] = mid+1 we recurse o the secod half of the array A[mid+1..high], otherwise we recurse o first half of the array A[low..mid], The algorithm termiates whe the search rage cosists of oly oe elemet (i.e. A[low] == A[high]) ad A[i] = i +. The missig umber is i + 1. We get the recurrece T () = T ( ) + Θ(1), which gives a worst-case ruig time of Θ(log ). We use the auxiliary array to keep track of the umbers we have see: A[i] = 0 if we have ot see i; A[i] = 1 if we have see i. Create auxiliary array B with idices 1 to + 1 Iitialize all locatios to 0 Go through all elemets of A ad set B[A[i]] = 1 Go through all elemets of B ad retur the i for which B[i] = 0. This is the missig umber.
3 1. [7 poits] Cosider a array of itegers A[0..-1]. The array is sorted i ascedig order ad there are o duplicate elemets. Assume the array has bee rotated i.e., the elemets have bee shifted multiple times to the right with the last elemet beig moved to the first positio i each step. For istace, A = [10, 0, 5, 40, 5] becomes A = [5, 40, 5, 10, 0] after its elemets were shifted to the right three times. Implemet a algorithm that fids the positio of a elemet i a rotated array. The asymptotic ruig time complexity of your algorithm must be O(log ). Use either C or pseudocode for your solutio. it search(it arr[], it low, it high, it key) { if (low > high) retur 1; it mid = (low + high) / ; if (arr[mid] == key) retur mid; if (arr[low] arr[mid]) { if (key arr[low] && key arr[mid]) { retur search(arr, low, mid 1, key); } retur search(arr, mid+1, high, key); } if (key arr[mid] && key arr[high]) { retur search(arr, mid+1, high, key); } retur search(arr, low, mid 1, key); 3
4 aa 4
5 Exercise 18 Poits Asymptotic Complexity.1 [6 poits] Calculate the simplest possible asymptotic tight boud for the followig fuctios. Iclude ay calculatio steps i your solutio: a) f 1 () = log( log()) f 1 () = log( log()) = log() + log log() Θ(log()) b) f () = log( i=1 i) f () = log( (+1) i=1 i) = log( ) = log( ( + 1)) log() = log() + log( + 1) log() Θ(log ) c) f 3 () = 16 log f 3 () = 16 log = 3 log = ( log ) 3 = 3 Θ( 3 ) d) f 4 () = log + log f 4 () = log + log = 1 log + log = + log Θ( log ) e) f 5 () = log 9 f 5 () = log 9 = log 9 Θ() f) f 6 () = 3 log f 6 () = 3 log = 7 log Θ(16 ) 5
6 . [6 poits] Calculate the asymptotic tight boud of the followig recurreces. If the Master Theorem ca be used, write dow a, b, f() ad the case (1-3). a) T () = 3T ( ) + a = 3, b =, f() =, log ba = log 3 = 1.58 f() = Ω( log ba+ɛ ), ɛ > 0 Case 3: Θ( ) Regularity coditio: if c = 3 4, a f(/b) = 3 ( ) 3 4 T () = Θ( ) b) T () = 4T ( 9 ) + 7 a = 4, b = 9, f() = 7 = 7 0.5, logab = log 49 = 0.63 f() = O( logab ɛ ), ɛ = 0.13 > 0 Case 1: Θ( log 9 4 ) c) T () = 9T ( ) a = 9, b = 4, f() = 3, logba = log94 = 0.63 f() = Ω( logba+ɛ ), ɛ > 0 Case 3: Θ( 3 ) Regularity coditio: if c = 9, a f(/b) = 9 ( 64 4 )3 9 T () = Θ( 3 ) 64 3 d) T () = log + T ( ) T () = log + T ( ) = log + log + T ( ) = log + log + log + T ( ) +... = log + 1 log log + 1 log = ( ) log 4 = + i=0 ( 1 )i log = log = Θ(log ) 6
7 .3 [6 poits] Cosider the recurrece: { 1 if = 1 T () = T (/3) + T (/9) + if > 1 a) [3 poits] Draw a recursio tree ad use it to estimate the asymptotic upper boud of T (). Iclude the tree-based calculatios that led to your estimate. = h = log = 4 9 = = ( 4 9 )h h h=0 ( 4 9 )h Logest brach o the left. Tree grows util ( 1 h 3) = 1 = h = log3 To get a upper boud, we ca use the sum h h=0 ( 4 9 )h. Guess: O() b) [3 poits] Prove the correctess of your estimate usig the substitutio method. Proof by iductio: T () = T (/3) + T (/9) + c 3 + c 9 + (recurrece) (iductive hyp.) = ( 4c + 9 ) (rewritig) 9 = (c 5c ) (rewritig) 9 = c ( 5c 9 ) (rewritig) 9 c (for c 9 5 ) 7
8 Exercise 3 13 Poits Rutime Aalysis Algorithm: whatdoesitdo(a, ) 1 tmp = 0; do 3 ready = 0; 4 for i = -1 to 1 do 5 if A[i-1]>A[i] the 6 tmp = A[i-1]; 7 A[i-1] = A[i]; 8 A[i] = tmp; 9 ready =1; 10 for i = 1 to -1 do 11 if A[i-1]>A[i] the 1 tmp = A[i-1]; 13 A[i-1] = A[i]; 14 A[i] = tmp; 15 ready =1; 16 while ready=1 ; 8
9 3.1 [3 poits] The algorithm whatdoesitdo(a,) gets a array A[0...-1] of itegers as a iput. Apply the algorithm o the array A=[8, 5, 10, 1, 3] ad complete each lie of the followig matrix if the cotet of A is modified. The already-completed lie of the matrix shows the iitial cotet of A. i A[0] A[1] A[] A[3] A[4] [4 poits] Describe i words what the algorithm whatdoesitdo(a,) does (maximum three lies). What is the best ad worst case for this algorithm, ad what are the asymptotic complexities i these cases. The algorithm sorts the array A, it is a variatio of bubble sort, this variatio sorts A i both directios o each pass through the list. Best case: O(), array already sorted i ascedig order. Worst case: O( ), array sorted i descedig order. 9
10 3.3 [6 poits] Aalyze the steps of the algorithm whatdoesitdo(a,) ad calculate its ruig time (worst case). lie 1 c 1 1 lie c 1 lie 3 c 3 lie 4 c 4 ( 1) lie 5-9 c 5 ( ) lie 10 c 6 ( 1) lie c 7 ( 1) lie 16 c 8 Ruig time: c 1 + c + c 3 + c 4 ( 1) + 4 c 5 ( ) + c 6 ( 1) + 4 c 7 ( 1) + c 8 10
11 Exercise 4 14 Poits Divide ad Coquer The maximum-subarray algorithm fids the cotiguous subarray that has the largest sum withi a usorted array A[0...-1] of itegers. For example, for array A = [-, -5, 6, -, -3, 1, 5], the maximum subarray is [6, -, -3, 1, 5]. The algorithm works as follows: Firstly, it divides the iput array ito two equal partitios: I (A[0]...A[mid]) ad II (A[mid+1]...A[-1]). Afterwards, it calls itself recursively o both partitios to fid the maximum subarray of each partitio. The combiatio step decides the maximum-subarray by comparig three arrays: the maximum-subarray from the left part, the maximum-subarray from the right part, ad the maximum-subarray that overlaps the middle. The maximum-subarray that overlaps the middle is determied by cosiderig all elemets to the left ad all elemets to the right of the middle. 4.1 [4 poits] Based o the above algorithm descriptio, draw a tree that illustrates the process of determiig the maximum subarray i array A = [-1,, -3, 4, 3, -5, 1, 5] max = [ 1] max = [] max = [ 3] max = [4] max = [3] max = [ 5] max = [1] max = [5] max = [] max = [4] max = [3] max = [1, 5] max = [4] max = [1, 5] max = [4, 3, 5, 1, 5]
12 4. [10 poits] Desig a divide ad coquer algorithm that fids ad returs the maximum subarray of a usorted array. Use either C or pseudocode for your solutio. Algorithm: MaxCrossSubarray(A, low, mid, high) 1 leftsum = ; sum = 0; 3 for i = mid to low do 4 sum = sum + A[i]; 5 if sum > leftsum the 6 leftsum = sum; 7 maxleft = i; 8 rightsum = ; 9 sum = 0; 10 for j = mid + 1 to high do 11 sum = sum + A[j]; 1 if sum > rightsum the 13 rightsum = sum; 14 maxright = j; 15 retur (maxleft, maxright, leftsum+rightsum); Algorithm: FidMaxSubarray(A, low, high) 16 if high == low the 17 retur (low, high, A[low]); 18 else 19 mid = low+high ; 0 (leftlow, lefthigh, leftsum)=fidmaxsubarray(a, low, mid); 1 (rightlow, righthigh, rightsum)=fidmaxsubarray(a, mid+1, high); (crosslow, crosshigh, crosssum)=maxcrosssubarray(a, low, mid, high); 3 if leftsum rightsum ad leftsum crosssum the 4 retur (leftlow, lefthigh, leftsum); 5 else if rightsum leftsum ad rightsum crosssum the 6 retur (rightlow, righthigh, rightsum); 7 else 8 retur (crosslow, crosshigh, crosssum); 1
13 13
Matriculation number: You have 90 minutes to complete the exam of InformatikIIb. The following rules apply:
Departmet of Iformatics Prof. Dr. Michael Böhle Bizmühlestrasse 14 8050 Zurich Phoe: +41 44 635 4333 Email: boehle@ifi.uzh.ch AlgoDat Midterm1 Sprig 016 08.04.016 Name: Matriculatio umber: Advice You have
More informationCOMP285 Midterm Exam Department of Mathematics
COMP85 Midterm Exam Departmet of Mathematics Fall 010/011 - November 8, 010 Name: Studet Number: Please fiish withi 90 miutes. All poits above 100 are cosidered as bous poit. You ca reach maximal 1 poits.
More informationCS / MCS 401 Homework 3 grader solutions
CS / MCS 401 Homework 3 grader solutios assigmet due July 6, 016 writte by Jāis Lazovskis maximum poits: 33 Some questios from CLRS. Questios marked with a asterisk were ot graded. 1 Use the defiitio of
More informationCS583 Lecture 02. Jana Kosecka. some materials here are based on E. Demaine, D. Luebke slides
CS583 Lecture 02 Jaa Kosecka some materials here are based o E. Demaie, D. Luebke slides Previously Sample algorithms Exact ruig time, pseudo-code Approximate ruig time Worst case aalysis Best case aalysis
More informationTest One (Answer Key)
CS395/Ma395 (Sprig 2005) Test Oe Name: Page 1 Test Oe (Aswer Key) CS395/Ma395: Aalysis of Algorithms This is a closed book, closed otes, 70 miute examiatio. It is worth 100 poits. There are twelve (12)
More informationThis Lecture. Divide and Conquer. Merge Sort: Algorithm. Merge Sort Algorithm. MergeSort (Example) - 1. MergeSort (Example) - 2
This Lecture Divide-ad-coquer techique for algorithm desig. Example the merge sort. Writig ad solvig recurreces Divide ad Coquer Divide-ad-coquer method for algorithm desig: Divide: If the iput size is
More informationCS 332: Algorithms. Linear-Time Sorting. Order statistics. Slide credit: David Luebke (Virginia)
1 CS 332: Algorithms Liear-Time Sortig. Order statistics. Slide credit: David Luebke (Virgiia) Quicksort: Partitio I Words Partitio(A, p, r): Select a elemet to act as the pivot (which?) Grow two regios,
More informationDivide & Conquer. Divide-and-conquer algorithms. Conventional product of polynomials. Conventional product of polynomials.
Divide-ad-coquer algorithms Divide & Coquer Strategy: Divide the problem ito smaller subproblems of the same type of problem Solve the subproblems recursively Combie the aswers to solve the origial problem
More informationCS 270 Algorithms. Oliver Kullmann. Growth of Functions. Divide-and- Conquer Min-Max- Problem. Tutorial. Reading from CLRS for week 2
Geeral remarks Week 2 1 Divide ad First we cosider a importat tool for the aalysis of algorithms: Big-Oh. The we itroduce a importat algorithmic paradigm:. We coclude by presetig ad aalysig two examples.
More informationData Structures Lecture 9
Fall 2017 Fag Yu Software Security Lab. Dept. Maagemet Iformatio Systems, Natioal Chegchi Uiversity Data Structures Lecture 9 Midterm o Dec. 7 (9:10-12:00am, 106) Lec 1-9, TextBook Ch1-8, 11,12 How to
More informationSorting Algorithms. Algorithms Kyuseok Shim SoEECS, SNU.
Sortig Algorithms Algorithms Kyuseo Shim SoEECS, SNU. Desigig Algorithms Icremetal approaches Divide-ad-Coquer approaches Dyamic programmig approaches Greedy approaches Radomized approaches You are ot
More informationData Structures and Algorithm. Xiaoqing Zheng
Data Structures ad Algorithm Xiaoqig Zheg zhegxq@fudaeduc What are algorithms? A sequece of computatioal steps that trasform the iput ito the output Sortig problem: Iput: A sequece of umbers
More informationAnalysis of Algorithms -Quicksort-
Aalysis of Algorithms -- Adreas Ermedahl MRTC (Mälardales Real-Time Research Ceter) adreas.ermedahl@mdh.se Autum 2004 Proposed by C.A.R. Hoare i 962 Worst- case ruig time: Θ( 2 ) Expected ruig time: Θ(
More informationModel of Computation and Runtime Analysis
Model of Computatio ad Rutime Aalysis Model of Computatio Model of Computatio Specifies Set of operatios Cost of operatios (ot ecessarily time) Examples Turig Machie Radom Access Machie (RAM) PRAM Map
More information4.3 Growth Rates of Solutions to Recurrences
4.3. GROWTH RATES OF SOLUTIONS TO RECURRENCES 81 4.3 Growth Rates of Solutios to Recurreces 4.3.1 Divide ad Coquer Algorithms Oe of the most basic ad powerful algorithmic techiques is divide ad coquer.
More informationAlgorithms and Data Structures Lecture IV
Algorithms ad Data Structures Lecture IV Simoas Šalteis Aalborg Uiversity simas@cs.auc.dk September 5, 00 1 This Lecture Aalyzig the ruig time of recursive algorithms (such as divide-ad-coquer) Writig
More informationClassification of problem & problem solving strategies. classification of time complexities (linear, logarithmic etc)
Classificatio of problem & problem solvig strategies classificatio of time complexities (liear, arithmic etc) Problem subdivisio Divide ad Coquer strategy. Asymptotic otatios, lower boud ad upper boud:
More informationAnalysis of Algorithms. Introduction. Contents
Itroductio The focus of this module is mathematical aspects of algorithms. Our mai focus is aalysis of algorithms, which meas evaluatig efficiecy of algorithms by aalytical ad mathematical methods. We
More informationModel of Computation and Runtime Analysis
Model of Computatio ad Rutime Aalysis Model of Computatio Model of Computatio Specifies Set of operatios Cost of operatios (ot ecessarily time) Examples Turig Machie Radom Access Machie (RAM) PRAM Map
More informationCS 332: Algorithms. Quicksort
CS 33: Aorithms Quicsort David Luebe //03 Homewor Assiged today, due ext Wedesday Will be o web page shortly after class Go over ow David Luebe //03 Review: Quicsort Sorts i place Sorts O( ) i the average
More informationRecurrence Relations
Recurrece Relatios Aalysis of recursive algorithms, such as: it factorial (it ) { if (==0) retur ; else retur ( * factorial(-)); } Let t be the umber of multiplicatios eeded to calculate factorial(). The
More informationIntroduction to Algorithms 6.046J/18.401J LECTURE 3 Divide and conquer Binary search Powering a number Fibonacci numbers Matrix multiplication
Itroductio to Algorithms 6.046J/8.40J LECTURE 3 Divide ad coquer Biary search Powerig a umber Fiboacci umbers Matrix multiplicatio Strasse s algorithm VLSI tree layout Prof. Charles E. Leiserso The divide-ad-coquer
More informationA recurrence equation is just a recursive function definition. It defines a function at one input in terms of its value on smaller inputs.
CS23 Algorithms Hadout #6 Prof Ly Turbak September 8, 200 Wellesley College RECURRENCES This hadout summarizes highlights of CLRS Chapter 4 ad Appedix A (CLR Chapters 3 & 4) Two-Step Strategy for Aalyzig
More informationDesign and Analysis of Algorithms
Desig ad Aalysis of Algorithms CSE 53 Lecture 9 Media ad Order Statistics Juzhou Huag, Ph.D. Departmet of Computer Sciece ad Egieerig Dept. CSE, UT Arligto CSE53 Desig ad Aalysis of Algorithms Medias ad
More informationFall 2018 Exam 3 HAND IN PART 0 10 PIN: 17 INSTRUCTIONS
MARK BOX problem poits HAND IN PART 0 10 1 10 2 5 NAME: Solutios 3 10 PIN: 17 4 16 65=13x5 % 100 INSTRUCTIONS This exam comes i two parts. (1) HAND IN PART. Had i oly this part. (2) STATEMENT OF MULTIPLE
More informationFundamental Algorithms
Fudametal Algorithms Chapter 2b: Recurreces Michael Bader Witer 2014/15 Chapter 2b: Recurreces, Witer 2014/15 1 Recurreces Defiitio A recurrece is a (i-equality that defies (or characterizes a fuctio i
More informationSolutions for the Exam 9 January 2012
Mastermath ad LNMB Course: Discrete Optimizatio Solutios for the Exam 9 Jauary 2012 Utrecht Uiversity, Educatorium, 15:15 18:15 The examiatio lasts 3 hours. Gradig will be doe before Jauary 23, 2012. Studets
More informationFall 2018 Exam 2 PIN: 17 INSTRUCTIONS
MARK BOX problem poits 0 0 HAND IN PART 0 3 0 NAME: Solutios 4 0 0 PIN: 6-3x % 00 INSTRUCTIONS This exam comes i two parts. () HAND IN PART. Had i oly this part. () STATEMENT OF MULTIPLE CHOICE PROBLEMS.
More informationMID-YEAR EXAMINATION 2018 H2 MATHEMATICS 9758/01. Paper 1 JUNE 2018
MID-YEAR EXAMINATION 08 H MATHEMATICS 9758/0 Paper JUNE 08 Additioal Materials: Writig Paper, MF6 Duratio: hours DO NOT OPEN THIS BOOKLET UNTIL YOU ARE TOLD TO DO SO READ THESE INSTRUCTIONS FIRST Write
More informationProblem Set 1 Solutions
V R N N N R f ] R S Itroductio to Algorithms September 12, 2003 Massachusetts Istitute of echology 6046J/18410J rofessors Shafi Goldwasser ad Silvio Micali Hadout 7 roblem Set 1 Solutios roblem 1-1 Recurrece
More informationOPTIMAL ALGORITHMS -- SUPPLEMENTAL NOTES
OPTIMAL ALGORITHMS -- SUPPLEMENTAL NOTES Peter M. Maurer Why Hashig is θ(). As i biary search, hashig assumes that keys are stored i a array which is idexed by a iteger. However, hashig attempts to bypass
More informationw (1) ˆx w (1) x (1) /ρ and w (2) ˆx w (2) x (2) /ρ.
2 5. Weighted umber of late jobs 5.1. Release dates ad due dates: maximimizig the weight of o-time jobs Oce we add release dates, miimizig the umber of late jobs becomes a sigificatly harder problem. For
More informationChapter 2. Asymptotic Notation
Asyptotic Notatio 3 Chapter Asyptotic Notatio Goal : To siplify the aalysis of ruig tie by gettig rid of details which ay be affected by specific ipleetatio ad hardware. [1] The Big Oh (O-Notatio) : It
More informationRecursive Algorithms. Recurrences. Recursive Algorithms Analysis
Recursive Algorithms Recurreces Computer Sciece & Egieerig 35: Discrete Mathematics Christopher M Bourke cbourke@cseuledu A recursive algorithm is oe i which objects are defied i terms of other objects
More informationA B = φ No conclusion. 2. (5) List the values of the sets below. Let A = {n 2 : n P n 5} = {1,4,9,16,25} and B = {n 4 : n P n 5} = {1,16,81,256,625}
CPSC 070 Aswer Keys Test # October 1, 014 1. (a) (5) Defie (A B) to be those elemets i set A but ot i set B. Use set membership tables to determie what elemets are cotaied i (A (B A)). Use set membership
More informationChapter 22 Developing Efficient Algorithms
Chapter Developig Efficiet Algorithms 1 Executig Time Suppose two algorithms perform the same task such as search (liear search vs. biary search). Which oe is better? Oe possible approach to aswer this
More informationSpring 2016 Exam 2 NAME: PIN:
MARK BOX problem poits 0 20 20 2 0 3 0 4-7 20 NAME: PIN: 8 0 9 0 % 00 INSTRUCTIONS O Problem 0, fill i the blaks. As you kow, if you do ot make at least half of the poits o Problem 0, the your score for
More informationAlgorithms Design & Analysis. Divide & Conquer
Algorithms Desig & Aalysis Divide & Coquer Recap Direct-accessible table Hash tables Hash fuctios Uiversal hashig Perfect Hashig Ope addressig 2 Today s topics The divide-ad-coquer desig paradigm Revised
More informationCOMP26120: More on the Complexity of Recursive Programs (2018/19) Lucas Cordeiro
COMP26120: More o the Complexity of Recursive Programs (2018/19) Lucas Cordeiro lucas.cordeiro@machester.ac.uk Divide-ad-Coquer (Recurrece) Textbook: Algorithm Desig ad Applicatios, Goodrich, Michael T.
More informationCh3. Asymptotic Notation
Ch. Asymptotic Notatio copyright 006 Preview of Chapters Chapter How to aalyze the space ad time complexities of program Chapter Review asymptotic otatios such as O, Ω, Θ, o for simplifyig the aalysis
More informationCATHOLIC JUNIOR COLLEGE General Certificate of Education Advanced Level Higher 2 JC2 Preliminary Examination MATHEMATICS 9740/01
CATHOLIC JUNIOR COLLEGE Geeral Certificate of Educatio Advaced Level Higher JC Prelimiary Examiatio MATHEMATICS 9740/0 Paper 4 Aug 06 hours Additioal Materials: List of Formulae (MF5) Name: Class: READ
More informationCS161: Algorithm Design and Analysis Handout #10 Stanford University Wednesday, 10 February 2016
CS161: Algorithm Desig ad Aalysis Hadout #10 Staford Uiversity Wedesday, 10 February 2016 Lecture #11: Wedesday, 10 February 2016 Topics: Example midterm problems ad solutios from a log time ago Sprig
More information4.1 Sigma Notation and Riemann Sums
0 the itegral. Sigma Notatio ad Riema Sums Oe strategy for calculatig the area of a regio is to cut the regio ito simple shapes, calculate the area of each simple shape, ad the add these smaller areas
More informationWRITTEN ASSIGNMENT 1 ANSWER KEY
CISC 65 Itrodutio Desig ad Aalysis of Algorithms WRITTEN ASSIGNMENT ANSWER KEY. Problem -) I geeral, this problem requires f() = some time period be solve for a value. This a be doe for all ase expet lg
More informationCIS 121 Data Structures and Algorithms with Java Spring Code Snippets and Recurrences Monday, February 4/Tuesday, February 5
CIS 11 Data Structures ad Algorithms with Java Sprig 019 Code Sippets ad Recurreces Moday, February 4/Tuesday, February 5 Learig Goals Practice provig asymptotic bouds with code sippets Practice solvig
More informationAverage-Case Analysis of QuickSort
Average-Case Aalysis of QuickSort Comp 363 Fall Semester 003 October 3, 003 The purpose of this documet is to itroduce the idea of usig recurrece relatios to do average-case aalysis. The average-case ruig
More informationCS:3330 (Prof. Pemmaraju ): Assignment #1 Solutions. (b) For n = 3, we will have 3 men and 3 women with preferences as follows: m 1 : w 3 > w 1 > w 2
Shiyao Wag CS:3330 (Prof. Pemmaraju ): Assigmet #1 Solutios Problem 1 (a) Cosider iput with me m 1, m,..., m ad wome w 1, w,..., w with the followig prefereces: All me have the same prefereces for wome:
More informationExamples: data compression, path-finding, game-playing, scheduling, bin packing
Algorithms - Basic Cocepts Algorithms so what is a algorithm, ayway? The dictioary defiitio: A algorithm is a well-defied computatioal procedure that takes iput ad produces output. This class will deal
More informationData Structures and Algorithms
Data Structures ad Algorithms Autum 2017-2018 Outlie 1 Sortig Algorithms (cotd) Outlie Sortig Algorithms (cotd) 1 Sortig Algorithms (cotd) Heapsort Sortig Algorithms (cotd) Have see that we ca build a
More informationMathematical Foundation. CSE 6331 Algorithms Steve Lai
Mathematical Foudatio CSE 6331 Algorithms Steve Lai Complexity of Algorithms Aalysis of algorithm: to predict the ruig time required by a algorithm. Elemetary operatios: arithmetic & boolea operatios:
More informationMath 116 Practice for Exam 3
Math 6 Practice for Exam Geerated October 0, 207 Name: SOLUTIONS Istructor: Sectio Number:. This exam has 7 questios. Note that the problems are ot of equal difficulty, so you may wat to skip over ad retur
More informationEXAM-3 MATH 261: Elementary Differential Equations MATH 261 FALL 2006 EXAMINATION COVER PAGE Professor Moseley
EXAM-3 MATH 261: Elemetary Differetial Equatios MATH 261 FALL 2006 EXAMINATION COVER PAGE Professor Moseley PRINT NAME ( ) Last Name, First Name MI (What you wish to be called) ID # EXAM DATE Friday Ocober
More informationEconomics 250 Assignment 1 Suggested Answers. 1. We have the following data set on the lengths (in minutes) of a sample of long-distance phone calls
Ecoomics 250 Assigmet 1 Suggested Aswers 1. We have the followig data set o the legths (i miutes) of a sample of log-distace phoe calls 1 20 10 20 13 23 3 7 18 7 4 5 15 7 29 10 18 10 10 23 4 12 8 6 (1)
More informationDynamic Programming. Sequence Of Decisions
Dyamic Programmig Sequece of decisios. Problem state. Priciple of optimality. Dyamic Programmig Recurrece Equatios. Solutio of recurrece equatios. Sequece Of Decisios As i the greedy method, the solutio
More informationDynamic Programming. Sequence Of Decisions. 0/1 Knapsack Problem. Sequence Of Decisions
Dyamic Programmig Sequece Of Decisios Sequece of decisios. Problem state. Priciple of optimality. Dyamic Programmig Recurrece Equatios. Solutio of recurrece equatios. As i the greedy method, the solutio
More informationCSI 2101 Discrete Structures Winter Homework Assignment #4 (100 points, weight 5%) Due: Thursday, April 5, at 1:00pm (in lecture)
CSI 101 Discrete Structures Witer 01 Prof. Lucia Moura Uiversity of Ottawa Homework Assigmet #4 (100 poits, weight %) Due: Thursday, April, at 1:00pm (i lecture) Program verificatio, Recurrece Relatios
More informationRandomized Algorithms I, Spring 2018, Department of Computer Science, University of Helsinki Homework 1: Solutions (Discussed January 25, 2018)
Radomized Algorithms I, Sprig 08, Departmet of Computer Sciece, Uiversity of Helsiki Homework : Solutios Discussed Jauary 5, 08). Exercise.: Cosider the followig balls-ad-bi game. We start with oe black
More informationPlease do NOT write in this box. Multiple Choice. Total
Istructor: Math 0560, Worksheet Alteratig Series Jauary, 3000 For realistic exam practice solve these problems without lookig at your book ad without usig a calculator. Multiple choice questios should
More informationSolutions. Number of Problems: 4. None. Use only the prepared sheets for your solutions. Additional paper is available from the supervisors.
Quiz November 4th, 23 Sigals & Systems (5-575-) P. Reist & Prof. R. D Adrea Solutios Exam Duratio: 4 miutes Number of Problems: 4 Permitted aids: Noe. Use oly the prepared sheets for your solutios. Additioal
More informationAnnotations to the assignments and the solution sheet. Note the following points
WS 26/7 Trial Exam: Fudametals of Computer Egieerig Seite: Aotatios to the assigmets ad the solutio sheet This is a multiple choice examiatio, that meas: Solutio approaches are ot assessed. For each sub-task
More informationCSI 5163 (95.573) ALGORITHM ANALYSIS AND DESIGN
CSI 5163 (95.573) ALGORITHM ANALYSIS AND DESIGN CSI 5163 (95.5703) ALGORITHM ANALYSIS AND DESIGN (3 cr.) (T) Topics of curret iterest i the desig ad aalysis of computer algorithms for graphtheoretical
More informationMath 475, Problem Set #12: Answers
Math 475, Problem Set #12: Aswers A. Chapter 8, problem 12, parts (b) ad (d). (b) S # (, 2) = 2 2, sice, from amog the 2 ways of puttig elemets ito 2 distiguishable boxes, exactly 2 of them result i oe
More informationDivide and Conquer. 1 Overview. 2 Multiplying Bit Strings. COMPSCI 330: Design and Analysis of Algorithms 1/19/2016 and 1/21/2016
COMPSCI 330: Desig ad Aalysis of Algorithms 1/19/2016 ad 1/21/2016 Lecturer: Debmalya Paigrahi Divide ad Coquer Scribe: Tiaqi Sog 1 Overview I this lecture, a importat algorithm desig techique called divide-ad-coquer
More information4.1 SIGMA NOTATION AND RIEMANN SUMS
.1 Sigma Notatio ad Riema Sums Cotemporary Calculus 1.1 SIGMA NOTATION AND RIEMANN SUMS Oe strategy for calculatig the area of a regio is to cut the regio ito simple shapes, calculate the area of each
More informationMAT1026 Calculus II Basic Convergence Tests for Series
MAT026 Calculus II Basic Covergece Tests for Series Egi MERMUT 202.03.08 Dokuz Eylül Uiversity Faculty of Sciece Departmet of Mathematics İzmir/TURKEY Cotets Mootoe Covergece Theorem 2 2 Series of Real
More informationLecture 3: Asymptotic Analysis + Recurrences
Lecture 3: Asymptotic Aalysis + Recurreces Data Structures ad Algorithms CSE 373 SU 18 BEN JONES 1 Warmup Write a model ad fid Big-O for (it i = 0; i < ; i++) { for (it j = 0; j < i; j++) { System.out.pritl(
More informationCSE Introduction to Parallel Processing. Chapter 3. Parallel Algorithm Complexity
Dr. Izadi CSE-40533 Itroductio to Parallel Processig Chapter 3 Parallel Algorithm Complexity Review algorithm complexity ad various complexity classes Itroduce the otios of time ad time-cost optimality
More informationAdvanced Course of Algorithm Design and Analysis
Differet complexity measures Advaced Course of Algorithm Desig ad Aalysis Asymptotic complexity Big-Oh otatio Properties of O otatio Aalysis of simple algorithms A algorithm may may have differet executio
More informationDavenport-Schinzel Sequences and their Geometric Applications
Advaced Computatioal Geometry Sprig 2004 Daveport-Schizel Sequeces ad their Geometric Applicatios Prof. Joseph Mitchell Scribe: Mohit Gupta 1 Overview I this lecture, we itroduce the cocept of Daveport-Schizel
More informationAlgorithm Analysis. Algorithms that are equally correct can vary in their utilization of computational resources
Algorithm Aalysis Algorithms that are equally correct ca vary i their utilizatio of computatioal resources time ad memory a slow program it is likely ot to be used a program that demads too much memory
More informationSequences, Mathematical Induction, and Recursion. CSE 2353 Discrete Computational Structures Spring 2018
CSE 353 Discrete Computatioal Structures Sprig 08 Sequeces, Mathematical Iductio, ad Recursio (Chapter 5, Epp) Note: some course slides adopted from publisher-provided material Overview May mathematical
More informationREGRESSION (Physics 1210 Notes, Partial Modified Appendix A)
REGRESSION (Physics 0 Notes, Partial Modified Appedix A) HOW TO PERFORM A LINEAR REGRESSION Cosider the followig data poits ad their graph (Table I ad Figure ): X Y 0 3 5 3 7 4 9 5 Table : Example Data
More informationZeros of Polynomials
Math 160 www.timetodare.com 4.5 4.6 Zeros of Polyomials I these sectios we will study polyomials algebraically. Most of our work will be cocered with fidig the solutios of polyomial equatios of ay degree
More informationDivide and Conquer II
Algorithms Divide ad Coquer II Divide ad Coquer II Desig ad Aalsis of Algorithms Adrei Bulatov Algorithms Divide ad Coquer II 6- Closest Pair: The Problem The Closest Pair Problem Istace: poits i the plae
More informationSimilar idea to multiplication in N, C. Divide and conquer approach provides unexpected improvements. Naïve matrix multiplication
Next. Covered bsics of simple desig techique (Divided-coquer) Ch. of the text.. Next, Strsse s lgorithm. Lter: more desig d coquer lgorithms: MergeSort. Solvig recurreces d the Mster Theorem. Similr ide
More information) n. ALG 1.3 Deterministic Selection and Sorting: Problem P size n. Examples: 1st lecture's mult M(n) = 3 M ( È
Algorithms Professor Joh Reif ALG 1.3 Determiistic Selectio ad Sortig: (a) Selectio Algorithms ad Lower Bouds (b) Sortig Algorithms ad Lower Bouds Problem P size fi divide ito subproblems size 1,..., k
More informationHomework 3. = k 1. Let S be a set of n elements, and let a, b, c be distinct elements of S. The number of k-subsets of S is
Homewor 3 Chapter 5 pp53: 3 40 45 Chapter 6 p85: 4 6 4 30 Use combiatorial reasoig to prove the idetity 3 3 Proof Let S be a set of elemets ad let a b c be distict elemets of S The umber of -subsets of
More information10.1 Sequences. n term. We will deal a. a n or a n n. ( 1) n ( 1) n 1 2 ( 1) a =, 0 0,,,,, ln n. n an 2. n term.
0. Sequeces A sequece is a list of umbers writte i a defiite order: a, a,, a, a is called the first term, a is the secod term, ad i geeral eclusively with ifiite sequeces ad so each term Notatio: the sequece
More informationAxioms of Measure Theory
MATH 532 Axioms of Measure Theory Dr. Neal, WKU I. The Space Throughout the course, we shall let X deote a geeric o-empty set. I geeral, we shall ot assume that ay algebraic structure exists o X so that
More informationMath 155 (Lecture 3)
Math 55 (Lecture 3) September 8, I this lecture, we ll cosider the aswer to oe of the most basic coutig problems i combiatorics Questio How may ways are there to choose a -elemet subset of the set {,,,
More information1 Hash tables. 1.1 Implementation
Lecture 8 Hash Tables, Uiversal Hash Fuctios, Balls ad Bis Scribes: Luke Johsto, Moses Charikar, G. Valiat Date: Oct 18, 2017 Adapted From Virgiia Williams lecture otes 1 Hash tables A hash table is a
More informationAlgorithm Analysis. Chapter 3
Data Structures Dr Ahmed Rafat Abas Computer Sciece Dept, Faculty of Computer ad Iformatio, Zagazig Uiversity arabas@zu.edu.eg http://www.arsaliem.faculty.zu.edu.eg/ Algorithm Aalysis Chapter 3 3. Itroductio
More information1 Cabin. Professor: What is. Student: ln Cabin oh Log Cabin! Professor: No. Log Cabin + C = A Houseboat!
MATH 4 Sprig 0 Exam # Tuesday March st Sectios: Sectios 6.-6.6; 6.8; 7.-7.4 Name: Score: = 00 Istructios:. You will have a total of hour ad 50 miutes to complete this exam.. A No-Graphig Calculator may
More informationThe Binomial Theorem
The Biomial Theorem Lecture 47 Sectio 9.7 Robb T. Koether Hampde-Sydey College Thu, Apr 8, 03 Robb T. Koether (Hampde-Sydey College The Biomial Theorem Thu, Apr 8, 03 / 7 Combiatios Pascal s Triagle 3
More informationSkip Lists. Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015 S 3 S S 1
Presetatio for use with the textbook, Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 2015 Skip Lists S 3 15 15 23 10 15 23 36 Skip Lists 1 What is a Skip List A skip list for
More informationMidterm Exam #2. Please staple this cover and honor pledge atop your solutions.
Math 50B Itegral Calculus April, 07 Midterm Exam # Name: Aswer Key David Arold Istructios. (00 poits) This exam is ope otes, ope book. This icludes ay supplemetary texts or olie documets. You are ot allowed
More informationMA131 - Analysis 1. Workbook 3 Sequences II
MA3 - Aalysis Workbook 3 Sequeces II Autum 2004 Cotets 2.8 Coverget Sequeces........................ 2.9 Algebra of Limits......................... 2 2.0 Further Useful Results........................
More informationThe Binomial Theorem
The Biomial Theorem Lecture 47 Sectio 9.7 Robb T. Koether Hampde-Sydey College Fri, Apr 8, 204 Robb T. Koether (Hampde-Sydey College The Biomial Theorem Fri, Apr 8, 204 / 25 Combiatios 2 Pascal s Triagle
More informationInfinite Sequences and Series
Chapter 6 Ifiite Sequeces ad Series 6.1 Ifiite Sequeces 6.1.1 Elemetary Cocepts Simply speakig, a sequece is a ordered list of umbers writte: {a 1, a 2, a 3,...a, a +1,...} where the elemets a i represet
More informationMATH 2300 review problems for Exam 2
MATH 2300 review problems for Exam 2. A metal plate of costat desity ρ (i gm/cm 2 ) has a shape bouded by the curve y = x, the x-axis, ad the lie x =. Fid the mass of the plate. Iclude uits. (b) Fid the
More informationCSE 1400 Applied Discrete Mathematics Number Theory and Proofs
CSE 1400 Applied Discrete Mathematics Number Theory ad Proofs Departmet of Computer Scieces College of Egieerig Florida Tech Sprig 01 Problems for Number Theory Backgroud Number theory is the brach of
More information3.2 Properties of Division 3.3 Zeros of Polynomials 3.4 Complex and Rational Zeros of Polynomials
Math 60 www.timetodare.com 3. Properties of Divisio 3.3 Zeros of Polyomials 3.4 Complex ad Ratioal Zeros of Polyomials I these sectios we will study polyomials algebraically. Most of our work will be cocered
More informationFind a formula for the exponential function whose graph is given , 1 2,16 1, 6
Math 4 Activity (Due by EOC Apr. ) Graph the followig epoetial fuctios by modifyig the graph of f. Fid the rage of each fuctio.. g. g. g 4. g. g 6. g Fid a formula for the epoetial fuctio whose graph is
More informationFall 2016 Exam 2 PIN: 17
MARK BOX problem poits 0 0 0 2-3 60=2x5 4 0 5 0 % 00 HAND IN PART NAME: Solutios PIN: 7 INSTRUCTIONS This exam comes i two parts. () HAND IN PART. Had i oly this part. (2) STATEMENT OF MULTIPLE CHOICE
More informationMerge and Quick Sort
Merge ad Quick Sort Merge Sort Merge Sort Tree Implemetatio Quick Sort Pivot Item Radomized Quick Sort Adapted from: Goodrich ad Tamassia, Data Structures ad Algorithms i Java, Joh Wiley & So (1998). Ruig
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 informationn m CHAPTER 3 RATIONAL EXPONENTS AND RADICAL FUNCTIONS 3-1 Evaluate n th Roots and Use Rational Exponents Real nth Roots of a n th Root of a
CHAPTER RATIONAL EXPONENTS AND RADICAL FUNCTIONS Big IDEAS: 1) Usig ratioal expoets ) Performig fuctio operatios ad fidig iverse fuctios ) Graphig radical fuctios ad solvig radical equatios Sectio: Essetial
More informationP1 Chapter 8 :: Binomial Expansion
P Chapter 8 :: Biomial Expasio jfrost@tiffi.kigsto.sch.uk www.drfrostmaths.com @DrFrostMaths Last modified: 6 th August 7 Use of DrFrostMaths for practice Register for free at: www.drfrostmaths.com/homework
More informationProblem Cosider the curve give parametrically as x = si t ad y = + cos t for» t» ß: (a) Describe the path this traverses: Where does it start (whe t =
Mathematics Summer Wilso Fial Exam August 8, ANSWERS Problem 1 (a) Fid the solutio to y +x y = e x x that satisfies y() = 5 : This is already i the form we used for a first order liear differetial equatio,
More informationCSE 4095/5095 Topics in Big Data Analytics Spring 2017; Homework 1 Solutions
CSE 09/09 Topics i ig Data Aalytics Sprig 2017; Homework 1 Solutios Note: Solutios to problems,, ad 6 are due to Marius Nicolae. 1. Cosider the followig algorithm: for i := 1 to α log e do Pick a radom
More information