CSE 332. Data Structures and Parallelism
|
|
- Dominick Barber
- 5 years ago
- Views:
Transcription
1 Aam Blak Lecture 6a Witer 2017 CSE 332 Data Structures a Parallelism
2 CSE 332: Data Structures a Parallelism More Recurreces T () T (/2) T (/2) T (/4) T (/4) T (/4) T (/4)
3 P1 De-Brief 1 You i somethig substatial! You worke with real worl software You hoe your ebuggig skills You trasitioe from 143 to 332 You ejoye it?? (okay, ot the ebuggig, but... ) Oh, some presets... tokes++ EX06 Now Due Moay; EX07 is ea :( While we re here...
4 Solvig the reverse Recurrece 2 0 if = 0 T () = c 0 +c 1 +T( 1) otherwise T () = (c 0 +c 1 ) + T ( 1) = (c 0 +c 1 ) + (c 0 +c 1 ( 1)) + T ( 2) = (c 0 +c 1 ) + (c 0 +c 1 ( 1)) + (c 0 +c 1 ( 2))++(c 0 +c 1 (1))+ 0 1 = i=0 1 = i=0 (c 0 +c 1 ( i)) c 0 + i=0 c 1 ( i) + 0 = c 0 +c 1 i + 0 i=1 = c 0 +c 1 ( (+1) ) = O( 2 )
5 Solvig Liear Recurreces 3 A recurrece where we solve some costat piece of the problem (e.g. -1, -2, etc.) is calle a Liear Recurrece. We solve these like we i above by Urollig the Recurrece. This is a facy way of sayig plug the efiitio ito itself util a patter emerges. Now, back to mergesort.
6 Aalyzig Merge Sort 4 Merge Sort 1 sort(l) { 2 if (L.size() < 2) { 3 retur L; 4 } 5 else { 6 it mi = L.size() / 2; 7 retur merge( 8 sort(l.sublist(0, mi)), 9 sort(l.sublist(mi, L.size())) 10 ); 11 } 12 } First, we ee to fi the recurrece: 0 if = 0 T () = 1 if = 1 c 0 +c 1 +2T (/2) otherwise This recurrece is t liear! This is a ivie a coquer recurrece.
7 Aalyzig Merge Sort 5 0 if = 0 T () = 1 if = 1 c 0 +c 1 +2T (/2) otherwise This time, there are multiple possible approaches: Urollig the Recurrece T () = (c 2 +c 1 ) + 2(c 2 +c 1 +2T (/4)) = (c 2 +c 1 ) + 2(c 2 +c 1 +2(c 2 +c 1 +2T (/8))) = c 2 +2c 2 + 4c 2 ++argh+ This works, but I rarely recomme it. Isight: We re brachig i this recurrece. So, represet it as a tree!
8 Merge Sort: Solvig the Recurrece 6 0 if = 0 T () = 1 if = 1 c 0 +c 1 +2T (/2) otherwise T ()
9 Merge Sort: Solvig the Recurrece 7 0 if = 0 T () = 1 if = 1 c 0 +c 1 +2T (/2) otherwise T (/2) T (/2)
10 Merge Sort: Solvig the Recurrece 8 0 if = 0 T () = 1 if = 1 c 0 +c 1 +2T (/2) otherwise /2 /2 T (/4) T (/4) T (/4) T (/4)
11 Merge Sort: Solvig the Recurrece 9 0 if = 0 T () = 1 if = 1 c 0 +c 1 +2T (/2) otherwise /2 /2 /4 /4 /4 /4
12 Merge Sort: Solvig the Recurrece 10 0 if = 0 T () = 1 if = 1 c 0 +c 1 +2T (/2) otherwise /2 /2 lg() /4 /4 /4 /4 Sice the recursio tree has height lg() a each row oes work, it follows that T () O(lg()).
13 sum Examples #1 11 Fi A Big-Oh Bou For The Worst Case Rutime 1 sum() { 2 if ( < 2) { 3 retur ; 4 } 5 retur 2 + sum( 2); 6 } 0 if = 0 T () = 0 if = 1 c 0 +T( 2) otherwise T () = c 0 +c 0 + +c = c 0 ( 2 )+ 0 = O()
14 sum Examples #2 12 Fi A Big-Oh Bou For The Worst Case Rutime 1 biarysearch(l, value) { 2 if (L.size() == 0) { 3 retur false; 4 } 5 else if (L.size() == 1) { 6 retur L[0] == value; 7 } 8 else { 9 it mi = L.size() / 2; 10 if (L[mi] < value) { 11 retur biarysearch(l.sublist(mi + 1, L.size()), value); 12 } 13 else { 14 retur biarysearch(l.sublist(0, mi), value); 15 } 16 } 17 } 0 if = 0 T () = 1 if = 1 c 0 +T(/2) otherwise
15 sum Examples # if = 0 T () = 1 if = 1 c 0 +T(/2) otherwise c 0 c 0 lg() c 0 1 So, T () = c 0 (lg() 1)+ 1 = O(lg).
16 Master Theorem 14 Cosier a recurrece of the form: if = 1 T () = at ( b )+c otherwise The, If log b (a) < c, the T () = Θ( c ). If log b (a) = c, the T () = Θ( c lg()). If log b (a) > c, the T () = Θ( log b (a) ). Saity Check: For Merge Sort, we have a = 2,b = 2,c = 1. The, log 2 (2) = 1 = 1. So, T () = lg.
17 Provig the First Case of Master Theorem 15 if = 1 T () = at ( b )+c otherwise We assume that log b (a) < c. The, urollig the recurrece, we get: T () = c +at (/b) = c +a((/b) c +at (/b 2 )) = c +a(/b) c +a 2 (/b 2 ) c + +a log b () (/b log b ) c log b () = i=0 a i ( c b ic ) log b () = c ( a i i=0 b c ) = c ( a b c ) log b ()+1 1 ( a b c ) 1 c (( a b c ) log b () ) c
18 Aam Blak Lecture 6b Witer 2017 CSE 332 Data Structures a Parallelism
19 CSE 332: Data Structures a Parallelism Amortize Aalysis
20 Stack ADT & ArrayStack Aalysis 1 Stack ADT push(val) pop() peek() isempty() As val to the stack. Returs the most-recet item ot alreay reture by a pop. (Errors if empty.) Returs the most-recet item ot alreay reture by a pop. (Errors if empty.) Returs true if all iserte elemets have bee reture by a pop. Let s aalyze the time complexity for these various methos. (You kow how they work, because you just implemete them!) Metho Time Complexity isempty() Θ(1) peek() Θ(1) pop() Θ(1) push(val)?? push is actually slightly more iterestig.
21 Aalyzig push for a ArrayStack 2 Best Case Worst Case Isight: Our aalysis seems wrog. Sayig liear time feels wrog.
22 Aalyzig push for a ArrayStack 2 Best Case There s more space i the uerlyig array! The, it s Ω(1). Worst Case Isight: Our aalysis seems wrog. Sayig liear time feels wrog.
23 Aalyzig push for a ArrayStack 2 Best Case There s more space i the uerlyig array! The, it s Ω(1). Worst Case If there s o more space, we ouble the size of the array, a copy all the elemets. So, it s O() Isight: Our aalysis seems wrog. Sayig liear time feels wrog.
24 Aalyzig push for a ArrayStack 3 This is where amortize aalysis comes i. Sometimes, we have a very rare expesive operatio that we ca charge to other operatios. Ituitio: Ret, Tuitio You pay oe big sum for a log perio of time, but you ca affor it because it happes very rarely. Back to ArrayStack Say we have a full Stack of size. The, cosier the ext pushes: The ext push will take O() (to resize the array to size 2) The 1 operatios after that will all be O(1), because we kow we have eough space Cosierig these operatios i aggregate, we have operatios that take (c 0 +c 1 )+( 1) c 2 time. So, how log oes each operatio take: (c 0 +c 1 )+( 1) c 2 max(c 0,c 2 )+c 1 = max(c 0,c 2 )+c 1 = O(1)
25 Aalyzig push for a ArrayStack 4 What happes if we chage our resize rule to each of the followig: Which is better 2, 3 2, or 5? Java uses 3 2 to miimize waste space.
26 Aalyzig push for a ArrayStack 4 What happes if we chage our resize rule to each of the followig: +1 This is really ba! We ca oly amortize over the sigle operatio which gives us: 1 = O() Which is better 2, 3 2, or 5? Java uses 3 2 to miimize waste space.
27 Aalyzig push for a ArrayStack 4 What happes if we chage our resize rule to each of the followig: +1 This is really ba! We ca oly amortize over the sigle operatio which gives us: 1 = O() 3 2 This still works. Now, we go over the ext 3 2 operatios: 5 +(/2 1) 1 2 = O(1) Which is better 2, 3 2, or 5? Java uses 3 2 to miimize waste space.
28 Aalyzig push for a ArrayStack 4 What happes if we chage our resize rule to each of the followig: +1 This is really ba! We ca oly amortize over the sigle operatio which gives us: 1 = O() 3 2 This still works. Now, we go over the ext 3 2 operatios: 5 This is goo too: +(/2 1) 1 2 = O(1) +(4 1) 1 = O(1) 4 Which is better 2, 3 2, or 5? Java uses 3 2 to miimize waste space.
Classification 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 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 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 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 informationLecture 7: Solving Recurrences
Lecture 7: Solvig Recurreces CSE 7: Data Structures ad Algorithms CSE 7 19 WI KASEY CHAMPION 1 Warm Up Writig Recurreces CSE 7 19 WI KASEY CHAMPION 2 Admiistriva HW 2 Part 1 due Friday git ruers will get
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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 informationHashing. Algorithm : Design & Analysis [09]
Hashig Algorithm : Desig & Aalysis [09] I the last class Implemetig Dictioary ADT Defiitio of red-black tree Black height Isertio ito a red-black tree Deletio from a red-black tree Hashig Hashig Collisio
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 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 informationDisjoint set (Union-Find)
CS124 Lecture 7 Fall 2018 Disjoit set (Uio-Fid) For Kruskal s algorithm for the miimum spaig tree problem, we foud that we eeded a data structure for maitaiig a collectio of disjoit sets. That is, we eed
More informationDATA STRUCTURES I, II, III, AND IV
Data structures DATA STRUCTURES I, II, III, AND IV I. Amortized Aalysis II. Biary ad Biomial Heaps III. Fiboacci Heaps IV. Uio Fid Static problems. Give a iput, produce a output. Ex. Sortig, FFT, edit
More informationAmortized Analysis - Part 2 - Dynamic Tables. Objective: In this lecture, we shall explore Dynamic tables and its amortized analysis in detail.
Idia Istitute of Iformatio Techology Desig ad Maufacturig, Kacheepuram Cheai 600 17, Idia A Autoomous Istitute uder MHRD, Govt of Idia http://www.iiitdm.ac.i COM 501 Advaced Data Structures ad Algorithms
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 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 informationCSE 202 Homework 1 Matthias Springer, A Yes, there does always exist a perfect matching without a strong instability.
CSE 0 Homework 1 Matthias Spriger, A9950078 1 Problem 1 Notatio a b meas that a is matched to b. a < b c meas that b likes c more tha a. Equality idicates a tie. Strog istability Yes, there does always
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 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 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 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 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 informationMerge Sort. Outline and Reading. Divide-and-Conquer. Divide-and-conquer paradigm ( 4.1.1) Merge-sort ( 4.1.1)
Merge Sort 7 2 9 4 2 4 7 9 7 2 2 7 9 4 4 9 7 7 2 2 9 9 4 4 Merge Sort versio 1.3 1 Outlie d Redig Divide-d-coquer prdigm ( 4.1.1 Merge-sort ( 4.1.1 Algorithm Mergig two sorted sequeces Merge-sort tree
More informationCS 5150/6150: Assignment 1 Due: Sep 23, 2010
CS 5150/6150: Assigmet 1 Due: Sep 23, 2010 Wei Liu September 24, 2010 Q1: (1) Usig master theorem: a = 7, b = 4, f() = O(). Because f() = log b a ε holds whe ε = log b a = log 4 7, we ca apply the first
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 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 informationDepartment of Informatics Prof. Dr. Michael Böhlen Binzmühlestrasse Zurich Phone:
Departmet of Iformatics Prof. Dr. Michael Böhle Bizmühlestrasse 14 8050 Zurich Phoe: +41 44 635 4333 Email: boehle@ifi.uzh.ch Iformatik II Midterm1 Sprig 018 3.03.018 Advice You have 90 miutes to complete
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 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 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 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 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 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 informationHand Out: Analysis of Algorithms. September 8, Bud Mishra. In general, there can be several algorithms to solve a problem; and one is faced
Had Out Aalysis of Algorithms September 8, 998 Bud Mishra c Mishra, February 9, 986 Itroductio I geeral, there ca be several algorithms to solve a problem; ad oe is faced with the problem of choosig a
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 informationMatriculation 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 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 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 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 informationORIE 633 Network Flows September 27, Lecture 8
ORIE 633 Network Flows September 7, 007 Lecturer: David P. Williamso Lecture 8 Scribe: Gema Plaza-Martíez 1 Global mi-cuts i udirected graphs 1.1 Radom cotractio Recall from last time we itroduced the
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 informationLecture 4 Recursive Algorithm Analysis. Merge Sort Solving Recurrences The Master Theorem
Lecture 4 Recursive Algorithm Alysis Merge Sort Solvig Recurreces The Mster Theorem Merge Sort MergeSortA, left, right) { if left < right) { mid floorleft right) / 2); MergeSortA, left, mid); MergeSortA,
More informationLecture 16: Monotone Formula Lower Bounds via Graph Entropy. 2 Monotone Formula Lower Bounds via Graph Entropy
15-859: Iformatio Theory ad Applicatios i TCS CMU: Sprig 2013 Lecture 16: Mootoe Formula Lower Bouds via Graph Etropy March 26, 2013 Lecturer: Mahdi Cheraghchi Scribe: Shashak Sigh 1 Recap Graph Etropy:
More informationPlan. Analysis of Multithreaded Algorithms. Plan. Matrix multiplication. University of Western Ontario, London, Ontario (Canada) Marc Moreno Maza
Pla Aalysis of Multithreaded Algorithms Marc Moreo Maza Uiversity of Wester Otario, Lodo, Otario (Caada) CS4402-9535 1 2 3 Pla (Moreo Maza) Aalysis of Multithreaded Algorithms CS4402-9535 1 / 27 (Moreo
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 informationHashing and Amortization
Lecture Hashig ad Amortizatio Supplemetal readig i CLRS: Chapter ; Chapter 7 itro; Sectio 7.. Arrays ad Hashig Arrays are very useful. The items i a array are statically addressed, so that isertig, deletig,
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 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 informationAlgorithms. Elementary Sorting. Dong Kyue Kim Hanyang University
Algorithms Elemetary Sortig Dog Kyue Kim Hayag Uiversity dqkim@hayag.a.kr Cotets Sortig problem Elemetary sortig algorithms Isertio sort Merge sort Seletio sort Bubble sort Sortig problem Iput A sequee
More information6.046 Recitation 5: Binary Search Trees Bill Thies, Fall 2004 Outline
6.046 Recitatio 5: Biary Search Trees Bill Thies, Fall 2004 Outlie My cotact iformatio: Bill Thies thies@mit.edu Office hours: Sat 1-3pm, 36-153 Recitatio website: http://cag.lcs.mit.edu/~thies/6.046/
More information11. Hash Tables. m is not too large. Many applications require a dynamic set that supports only the directory operations INSERT, SEARCH and DELETE.
11. Hash Tables May applicatios require a dyamic set that supports oly the directory operatios INSERT, SEARCH ad DELETE. A hash table is a geeralizatio of the simpler otio of a ordiary array. Directly
More informationAn Introduction to Randomized Algorithms
A Itroductio to Radomized Algorithms The focus of this lecture is to study a radomized algorithm for quick sort, aalyze it usig probabilistic recurrece relatios, ad also provide more geeral tools for aalysis
More informationInverse Matrix. A meaning that matrix B is an inverse of matrix A.
Iverse Matrix Two square matrices A ad B of dimesios are called iverses to oe aother if the followig holds, AB BA I (11) The otio is dual but we ofte write 1 B A meaig that matrix B is a iverse of matrix
More informationLecture 4 Recursive Algorithm Analysis. Merge Sort Solving Recurrences The Master Theorem
Lecture 4 Recursive Algorithm Alysis Merge Sort Solvig Recurreces The Mster Theorem Merge Sort MergeSortA, left, right) { if left < right) { mid = floorleft + right) / 2); MergeSortA, left, mid); MergeSortA,
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 informationLecture #3. Math tools covered today
Toay s Program:. Review of previous lecture. QM free particle a particle i a bo. 3. Priciple of spectral ecompositio. 4. Fourth Postulate Math tools covere toay Lecture #3. Lear how to solve separable
More informationIntroduction to Algorithms
Itroductio to Algorithms 6.046J/8.40J/SMA5503 Lecture 9 Pro. Charles E. Leiserso Biary-search-tree sort T Create a empty BST or i to do TREE-INSERT(T, A[i]) Perorm a iorder tree wal o T. Eample: A [3 8
More informationIntermediate Math Circles November 4, 2009 Counting II
Uiversity of Waterloo Faculty of Mathematics Cetre for Educatio i Mathematics ad Computig Itermediate Math Circles November 4, 009 Coutig II Last time, after lookig at the product rule ad sum rule, we
More informationTheorem: Let A n n. In this case that A does reduce to I, we search for A 1 as the solution matrix X to the matrix equation A X = I i.e.
Theorem: Let A be a square matrix The A has a iverse matrix if ad oly if its reduced row echelo form is the idetity I this case the algorithm illustrated o the previous page will always yield the iverse
More informationCS161 Design and Analysis of Algorithms. Administrative
CS161 Desig ad Aalysis of Algorithms Da Boeh 1 Admiistrative Lecture 1, April 3, 1 Web page http://theory.staford.edu/~dabo/cs161» Hadouts» Aoucemets» Late breakig ews Gradig ad course requiremets» Midterm/fial/hw»
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 informationCS161 Handout 05 Summer 2013 July 10, 2013 Mathematical Terms and Identities
CS161 Hadout 05 Summer 2013 July 10, 2013 Mathematical Terms ad Idetities Thaks to Ady Nguye ad Julie Tibshirai for their advice o this hadout. This hadout covers mathematical otatio ad idetities that
More informationCS166 Handout 02 Spring 2018 April 3, 2018 Mathematical Terms and Identities
CS166 Hadout 02 Sprig 2018 April 3, 2018 Mathematical Terms ad Idetities Thaks to Ady Nguye ad Julie Tibshirai for their advice o this hadout. This hadout covers mathematical otatio ad idetities that may
More informationIP Reference guide for integer programming formulations.
IP Referece guide for iteger programmig formulatios. by James B. Orli for 15.053 ad 15.058 This documet is iteded as a compact (or relatively compact) guide to the formulatio of iteger programs. For more
More informationCache-Efficient Algorithms II
6.172 Performace Egieerig of Software Systems LECTURE 9 Cache-Efficiet Algorithms II Charles E. Leiserso October 7, 2010 2010 Charles E. Leiserso 1 Ideal-Cache Model Features Two-level hierarchy. Cache
More informationIntroduction to Algorithms
Itroductio to Algorithms 6.046J/8.40J LECTURE 9 Radomly built biary search trees Epected ode depth Aalyzig height Coveity lemma Jese s iequality Epoetial height Post mortem Pro. Eri Demaie October 7, 2005
More informationCSE 5311 Notes 1: Mathematical Preliminaries
Chapter 1 - Algorithms Computig CSE 5311 Notes 1: Mathematical Prelimiaries Last updated 1/20/18 12:56 PM) Relatioship betwee complexity classes, eg log,, log, 2, 2, etc Chapter 2 - Gettig Started Loop
More informationRecurrences: Methods and Examples
Reurrees: Methods ad Examples CSE 30 Algorithms ad Data Strutures Alexadra Stefa Uiversity of exas at Arligto Updated: 308 Summatios Review Review slides o Summatios Reurrees Reursive algorithms It may
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 informationAlgorithms in The Real World Fall 2002 Homework Assignment 2 Solutions
Algorithms i The Real Worl Fall 00 Homewor Assigmet Solutios Problem. Suppose that a bipartite graph with oes o the left a oes o the right is costructe by coectig each oe o the left to raomly-selecte oes
More informationAmortized analysis. Amortized analysis
In amortized analysis the goal is to bound the worst case time of a sequence of operations on a data-structure. If n operations take T (n) time (worst case), the amortized cost of an operation is T (n)/n.
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 informationAddition: Property Name Property Description Examples. a+b = b+a. a+(b+c) = (a+b)+c
Notes for March 31 Fields: A field is a set of umbers with two (biary) operatios (usually called additio [+] ad multiplicatio [ ]) such that the followig properties hold: Additio: Name Descriptio Commutativity
More informationMath F215: Induction April 7, 2013
Math F25: Iductio April 7, 203 Iductio is used to prove that a collectio of statemets P(k) depedig o k N are all true. A statemet is simply a mathematical phrase that must be either true or false. Here
More informationSECTION 1.5 : SUMMATION NOTATION + WORK WITH SEQUENCES
SECTION 1.5 : SUMMATION NOTATION + WORK WITH SEQUENCES Read Sectio 1.5 (pages 5 9) Overview I Sectio 1.5 we lear to work with summatio otatio ad formulas. We will also itroduce a brief overview of sequeces,
More informationNotes for Lecture 5. 1 Grover Search. 1.1 The Setting. 1.2 Motivation. Lecture 5 (September 26, 2018)
COS 597A: Quatum Cryptography Lecture 5 (September 6, 08) Lecturer: Mark Zhadry Priceto Uiversity Scribe: Fermi Ma Notes for Lecture 5 Today we ll move o from the slightly cotrived applicatios of quatum
More informationDivide and Conquer. 1 Overview. 2 Insertion Sort. 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 Divide ad Coquer Lecturer: Debmalya Paigrahi Scribe: Tiaqi Sog, Tiayu Wag 1 Overview This set of otes is orgaized as follows. We begi
More informationMatrix Algebra 2.2 THE INVERSE OF A MATRIX Pearson Education, Inc.
2 Matrix Algebra 2.2 THE INVERSE OF A MATRIX MATRIX OPERATIONS A matrix A is said to be ivertible if there is a matrix C such that CA = I ad AC = I where, the idetity matrix. I = I I this case, C is a
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 informationThe Selection Problem - Variable Size Decrease/Conquer (Practice with algorithm analysis)
We have covered: Selecto, Iserto, Mergesort, Bubblesort, Heapsort Next: Selecto the Qucksort The Selecto Problem - Varable Sze Decrease/Coquer (Practce wth algorthm aalyss) Cosder the problem of fdg the
More informationCHAPTER I: Vector Spaces
CHAPTER I: Vector Spaces Sectio 1: Itroductio ad Examples This first chapter is largely a review of topics you probably saw i your liear algebra course. So why cover it? (1) Not everyoe remembers everythig
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 informationCOMP26120: Introducing Complexity Analysis (2018/19) Lucas Cordeiro
COMP60: Itroduig Complexity Aalysis (08/9) Luas Cordeiro luas.ordeiro@mahester.a.uk Itroduig Complexity Aalysis Textbook: Algorithm Desig ad Appliatios, Goodrih, Mihael T. ad Roberto Tamassia (hapter )
More informationRank Modulation with Multiplicity
Rak Modulatio with Multiplicity Axiao (Adrew) Jiag Computer Sciece ad Eg. Dept. Texas A&M Uiversity College Statio, TX 778 ajiag@cse.tamu.edu Abstract Rak modulatio is a scheme that uses the relative order
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 information