CS 350 Algorithms and Complexity

Size: px
Start display at page:

Download "CS 350 Algorithms and Complexity"

Transcription

1 CS 350 Algorithms and Complexity Spring 2015 Lecture 8: Decrease & Conquer (continued) Andrew P. Black Department of Computer Science Portland State University

2 Ferrying Soldiers!A detachment of n soldiers must cross a wide and deep river with no bridge in sight. They notice two 12-year-old boys playing in a rowboat by the shore. The boat is so tiny, that it can hold just two boys or one soldier. " How can the soldiers get across the river and leave the boys in joint possession of the boat? " How many times need the boat pass from shore to shore? 2

3 Ferrying Soldiers!Apply decrease-by-1 process: " Ferry one soldier to the far side, leaving boat and boys back at their initial positions 3

4 Ferrying Soldiers!Apply decrease-by-1 process: " Ferry one soldier to the far side, leaving boat and boys back at their initial positions " If no soldiers remain, we have finished, 3

5 Ferrying Soldiers!Apply decrease-by-1 process: " Ferry one soldier to the far side, leaving boat and boys back at their initial positions " If no soldiers remain, we have finished, " otherwise, ferry remaining n 1 soldiers 3

6 Ferrying Soldiers!Apply decrease-by-1 process: " Ferry one soldier to the far side, leaving boat and boys back at their initial positions " If no soldiers remain, we have finished, " otherwise, ferry remaining n 1 soldiers!how many (one way) boat trips will it take to ferry one soldier? 3

7 Ferrying Soldiers!Apply decrease-by-1 process: " Ferry one soldier to the far side, leaving boat and boys back at their initial positions " If no soldiers remain, we have finished, " otherwise, ferry remaining n 1 soldiers!how many (one way) boat trips will it take to ferry one soldier? A. 1 B. 2 C. 3 D. 4 E. 5 F. 6 3

8 Alternating Glasses! There are 2n glasses standing in a row, the first n of them filled with beer, while the remaining n glasses are empty. Make the glasses alternate in a filled-empty-filled-empty pattern in the minimum number of moves. " Interchanging (any) two glasses is one move 4

9 Alternating Glasses! There are 2n glasses standing in a row, the first n of them filled with beer, while the remaining n glasses are empty. Make the glasses alternate in a filled-empty-filled-empty pattern in the minimum number of moves. " Interchanging (any) two glasses is one move 4

10 Alternating Glasses! There are 2n glasses standing in a row, the first n of them filled with beer, while the remaining n glasses are empty. Make the glasses alternate in a filled-empty-filled-empty pattern in the minimum number of moves. " Interchanging (any) two glasses is one move 4

11 Alternating Glasses! There are 2n glasses standing in a row, the first n of them filled with beer, while the remaining n glasses are empty. Make the glasses alternate in a filled-empty-filled-empty pattern in the minimum number of moves. " Interchanging (any) two glasses is one move! Apply decrease by-a-constant: " What smaller problem can we solve that will help? 5

12 Depth-first Search!Levitin says: " Depth-first Search uses a Stack, while " Breadth-first search uses a queue 7

13 8

14

15 Example: BFS traversal of undirected graph a b c d e f g h BFS traversal queue: BFS tree: 10

16 Depth-first Search!Levitin says: Depth-first Search uses a Stack, Breadth-first search uses a queue!where s the stack? 11

17 DFS with explicit stack!dfs(r) S stack.empty S.push(r) while {S.notEmpty} do { } u S.pop if (u.hasbeenvisited.not) then { } u.markvisited u.adjacentverticesdo { v S.push(v) } 12

18 Example: DFS traversal of undirected graph a b c d e f g h DFS traversal stack: DFS tree: 13

19 Topological Sorting Example Order the following items in a food chain tiger human fish shrimp sheep plankton wheat 14

20 Topological Sort using decrease-by-one!basic idea: " topsort a graph with one less vertex " combine the additional vertex with the sorted graph!problem: " How to choose a vertex that can be easily recombined? 15

21 Which vertex should we remove? fish human shrimp tiger sheep A. fish B. shrimp C. plankton D. wheat E. sheep F. human G. tiger plankton wheat 16

22 Decrease by a Constant Factor!binary search and bisection method ( 12.4)!exponentiation by squaring!multiplication à la russe 17

23 Variable-size decrease!euclid s algorithm!median (or percentile) by partition!nim-like games 18

24 Finding the Median!The Median of an array of numbers is the middle number, when sorted.!we can obviously find the median by sorting j the array, and then picking the n k th element 2!How much work is that (in average case)? A. O(n) B. O(n lg n) C. O(n 2 ) D. something else 19

25 Median in Linear Time?! Can we do better?! After all, sorting the whole array is more work than is needed to find the median! Key insight: generalize the problem!! Rather than seeking an algorithm for the th element, lets look for the k th element, k [1..n] Suppose that we have a way of partitioning the array at element with value p: How can this help? l p p p r j n 2 k 20

26 l r A = p p p!suppose that we are looking for the 10 th element, and: # Alo = 5 # Ap = 1 Alo Ap Ahi " Then we can seek the 4 th element of Ahi instead " We have reduced the problem size by a variable amount, in this case Alo + Ap = 6 21

27 l r A = p p p Alo Ap Ahi!Suppose that we are looking for the 10 th element, and: # Alo = 28 " Then we can seek the 10 th element of Alo instead " We have reduced the problem size by a variable amount, in this case Ap + Ahi 22

28 l r A = p p p!suppose that we are looking for the 8 th element, and: # Alo = 6 # Ap = 2 Alo Ap Ahi " Then we can seek the 2 nd element of Ap instead. " We have now solved the problem, because all the elements of Ap are p 23

29 Variable-size decrease?!what s the connection? " suppose that we have A[1:20] and are looking for the 7 th -smallest element: " run partition, find s = 9, say " Where do we look for the 7 th -smallest element? A: A[1..20] B: A[1..8] C: A[1..9] D: A[10..20] 24

30 Variable-size decrease?!what s the connection? " suppose that we have A[1:20] and are looking for the 7 th -smallest element: " run partition, find s = 3, say " Where do we look for the 7 th -smallest element? A: A[1..3] B: A[1..4] C: A[3..20] D: A[4..20] 25

31 What s the Efficiency?!Dasgupta s analysis shows that: if we can do the partition in O(n) time, then we can select the k th element in O(n) time!how can we do partition in O(n) time? Lomuto Partition Hoare Partition 26

32 Lomuto Partition!While algorithm is running: l s i r p < p p?!invariant: " A[l] = p A[l+1.. s] < p A[s+1.. i 1] p l s < i r!establish invariant initially: " p A[l]; s l; i s+1 // makes < p interval and p intervals both empty 27

33 I don't like Lumuto Partition!It does more swaps than necessary l s i r p < p p? 28

34 I don't like Lumuto Partition!It does more swaps than necessary l s i r p < p p? " half of the swap is wasted!it confuses students! " Quicksort does not use the Lumuto Partition 28

35 Hoare Partition!Classic algorithm of computing!developed in 1959, published in 1961.!Not only linear, but peculiarly efficient!!tony Hoare won the Turing Award for Quicksort, which is based on this algorithm... and some other things! 29

36 Partition: CACM (Vol 4) July 1961 ALGORITHM 63 PARTITION C. A. R. HOARE Elliott Brothers Ltd., Borehamwood, Hertfordshire, En procedure partition (A,M,N,I,J); value M,N; array A; integer M,N,1,J; conunent I and J are output variables, and A is the array (wi subscript bounds M:N) which is operated upon by this procedur Partition takes the value X of a random element of the array and rearranges the values of the elements of the array in such way that there exist integers I and J with the following propertie M _-< J < I =< NprovidedM < N A[R] =< XforM =< R _-< J A[R] = XforJ < R < I A[R] ~ Xfor I =< R ~ N The procedure uses an integer procedure random (M,N) whi chooses equiprobably a random integer F between M and N, a also a procedure exchange, which exchanges the values of its tw parameters ; begin real X; integer F; F := random (M,N); I:=M; J:=N; up: X := A[F]; for I : = I step 1 until N do if X < A [I] then go to down; I:=N; down: forj := J step --1 until M do if A[J]<X then go to change; J:=M; change: else if I < J then begin exchange (A[IL A[J]); I := I+ 1;J:= J - 1; go to up end if [ < F then begin exchange (A[IL A[F]) i I:=I+l end else if F < J tllen begin exchange (A[F], A[J]) ; J:=J-1 end ; end partition 30

37 Partition: CACM (Vol 4) July 1961 ALGORITHM 63 PARTITION C. A. R. HOARE Elliott Brothers Ltd., Borehamwood, Hertfordshire, En procedure partition (A,M,N,I,J); value M,N; array A; integer M,N,1,J; conunent I and J are output variables, and A is the array (wi subscript bounds M:N) which is operated upon by this procedur Partition takes the value X of a random element of the array and rearranges the values of the elements of the array in such way that there exist integers I and J with the following propertie M _-< J < I =< NprovidedM < N A[R] =< XforM =< R _-< J A[R] = XforJ < R < I A[R] ~ Xfor I =< R ~ N The procedure uses an integer procedure random (M,N) whi chooses equiprobably a random integer F between M and N, a also a procedure exchange, which exchanges the values of its tw parameters ; begin real X; integer F; F := random (M,N); I:=M; J:=N; up: X := A[F]; for I : = I step 1 until N do if X < A [I] then go to down; I:=N; down: forj := J step --1 until M do if A[J]<X then go to change; J:=M; change: else if I < J then begin exchange (A[IL A[J]); I := I+ 1;J:= J - 1; go to up end if [ < F then begin exchange (A[IL A[F]) i I:=I+l end else if F < J tllen begin exchange (A[F], A[J]) ; J:=J-1 end ; end partition Important features: random pivot double-ended search works in place two outputs 30

38 Hoare Partition method partition(a, lo, hi) { def pivotindex = randombetween(lo)and(hi) def pivot = A[pivotIndex] var i := lo 1 var j := hi+1 while { do { i := i + 1 } while { (i <= hi).andalso {A[i] <= pivot} } do { j := j 1 } while { (j >= lo).andalso {A[j] >= pivot} } i < j } do { exchange(a, i, j) } if (i < pivotindex) then { exchange(a, i, pivotindex) ; i := i + 1 } elseif (j > pivotindex) then { exchange(a, pivotindex, j) ; j := j 1 } list.with(i, j) } 31

39 Before partition begins: i lo p hi j 7

40 Before partition begins: i lo p hi j Leave elements that are already in the right place: i j lo hi 7

41 Before partition begins: i lo p hi j Leave elements that are already in the right place: i j lo hi Now a[i] p a[j], so swap a[i] and a[j]: i j lo hi 7

42 Before partition begins: i lo p hi j Leave elements that are already in the right place: i j lo hi Now a[i] p a[j], so swap a[i] and a[j]: i j lo p hi 7

43 Before partition begins: i lo p hi j Leave elements that are already in the right place: i j lo hi Now a[i] p a[j], so swap a[i] and a[j]: i j lo p p hi 7

44 Before partition begins: i lo p hi j Leave elements that are already in the right place: i j lo hi Now a[i] p a[j], so swap a[i] and a[j]: i j lo p And continue... i j p hi lo hi 7

45 when do we stop? And continue... i j lo hi until i and j cross! j i lo p p hi 33

46 when do we stop? And continue... i j lo hi until i and j cross! j i lo p p hi is this possible? j i lo hi 33

47 12 Coins " This problem is originally stated as:! You have a balance scale and 12 coins, 1 of which is counterfeit. The counterfeit weigh less or more than the other coins. Can you determine the counterfeit in 3 weightings, and tell if it is heavier or lighter? " A harder and more general problem is:! For some given n > 1, there are (3 n 3)/2 coins, 1 of which is counterfeit. The counterfeit weigh less or more than the other coins. Can you state a priori n weighting experiments with a balance, with which you determine the counterfeit coin, and tell if it is heavier or lighter? 34

48 Problem: Mazes One can model a maze by having a vertex for a starting point, a finishing point, dead ends, and all the points in the maze where more than one path can be taken, and then connecting the vertices according to the paths in the maze. a. Construct such a graph for the following maze. b. Which traversal DFS or BFS would you use if you found yourself in a maze and why? 35

49 Problem: Mazes One can model a maze by having a vertex for a starting point, a finishing point, dead ends, and all the points in the maze where more than one path can be taken, and then connecting the vertices according to the paths in the maze. a. Construct such a graph for the following maze. b. Which traversal DFS or BFS would you use if you found yourself in a maze and why? 35

50 Problem: Mazes One can model a maze by having a vertex for a starting point, a finishing point, dead ends, and all the points in the maze where more than one path can be taken, and then connecting the vertices according to the paths in the maze. a. Construct such a graph for the following maze. b. Which traversal DFS or BFS would you use if you found yourself in a maze and why? A: DFS B: BFS 35

51 Problem: Gray Code Use the decrease-by-one technique (Algorithm BRGC) to generate the binary reflected Gray code for n = 4. 36

52 Problem: Gray Code Use the decrease-by-one technique (Algorithm BRGC) to generate the binary reflected Gray code for n = n = 1 n = 2 n = 3 36

53 Problem: Gray Code Algorithm! Trace the following algorithm for generating the Binary Gray Code of order 4. Start with code = 0000 output code for i = 1 to 15 do: b position of least significant 1 in binary rep of i code code XOR (bit b) output code 37

54 Nim!1 pile of n chips!players take turns removing 1 k m chips!the player removing the last chip wins m = 4 38

55 Nim!1 pile of n chips!players take turns removing 1 k m chips!the player removing the last chip wins m = 4 38

56 Nim!1 pile of n chips!players take turns removing 1 k m chips!the player removing the last chip wins m = 4 38

57 Nim!1 pile of n chips!players take turns removing 1 k m chips!the player removing the last chip wins m = 4 39

58 Nim!1 pile of n chips!players take turns removing 1 k m chips!the player removing the last chip wins m = 4 39

59 Nim!1 pile of n chips!players take turns removing 1 k m chips!the player removing the last chip wins m = 4 39

60 Multiplication à la russe n m = ( n 2 2m if n is even n 1 2 2m + m if n is odd 40

61 You try it!!multiply n m

CS 350 Algorithms and Complexity

CS 350 Algorithms and Complexity CS 350 Algorthms and Complexty Wnter 2015 Lecture 8: Decrease & Conquer (contnued) Andrew P. Black Department of Computer Scence Portland State Unversty Example: DFS traversal of undrected graph a b c

More information

Algorithms, CSE, OSU Quicksort. Instructor: Anastasios Sidiropoulos

Algorithms, CSE, OSU Quicksort. Instructor: Anastasios Sidiropoulos 6331 - Algorithms, CSE, OSU Quicksort Instructor: Anastasios Sidiropoulos Sorting Given an array of integers A[1... n], rearrange its elements so that A[1] A[2]... A[n]. Quicksort Quicksort(A, p, r) if

More information

Algorithms And Programming I. Lecture 5 Quicksort

Algorithms And Programming I. Lecture 5 Quicksort Algorithms And Programming I Lecture 5 Quicksort Quick Sort Partition set into two using randomly chosen pivot 88 31 25 52 14 98 62 30 23 79 14 31 2530 23 52 88 62 98 79 Quick Sort 14 31 2530 23 52 88

More information

Algorithms and Data Structures 2016 Week 5 solutions (Tues 9th - Fri 12th February)

Algorithms and Data Structures 2016 Week 5 solutions (Tues 9th - Fri 12th February) Algorithms and Data Structures 016 Week 5 solutions (Tues 9th - Fri 1th February) 1. Draw the decision tree (under the assumption of all-distinct inputs) Quicksort for n = 3. answer: (of course you should

More information

1 Quick Sort LECTURE 7. OHSU/OGI (Winter 2009) ANALYSIS AND DESIGN OF ALGORITHMS

1 Quick Sort LECTURE 7. OHSU/OGI (Winter 2009) ANALYSIS AND DESIGN OF ALGORITHMS OHSU/OGI (Winter 2009) CS532 ANALYSIS AND DESIGN OF ALGORITHMS LECTURE 7 1 Quick Sort QuickSort 1 is a classic example of divide and conquer. The hard work is to rearrange the elements of the array A[1..n]

More information

Week 5: Quicksort, Lower bound, Greedy

Week 5: Quicksort, Lower bound, Greedy Week 5: Quicksort, Lower bound, Greedy Agenda: Quicksort: Average case Lower bound for sorting Greedy method 1 Week 5: Quicksort Recall Quicksort: The ideas: Pick one key Compare to others: partition into

More information

Lecture 4. Quicksort

Lecture 4. Quicksort Lecture 4. Quicksort T. H. Cormen, C. E. Leiserson and R. L. Rivest Introduction to Algorithms, 3rd Edition, MIT Press, 2009 Sungkyunkwan University Hyunseung Choo choo@skku.edu Copyright 2000-2018 Networking

More information

Review Of Topics. Review: Induction

Review Of Topics. Review: Induction Review Of Topics Asymptotic notation Solving recurrences Sorting algorithms Insertion sort Merge sort Heap sort Quick sort Counting sort Radix sort Medians/order statistics Randomized algorithm Worst-case

More information

Analysis of Algorithms. Randomizing Quicksort

Analysis of Algorithms. Randomizing Quicksort Analysis of Algorithms Randomizing Quicksort Randomizing Quicksort Randomly permute the elements of the input array before sorting OR... modify the PARTITION procedure At each step of the algorithm we

More information

Data Structures and Algorithms

Data Structures and Algorithms Data Structures and Algorithms Spring 2017-2018 Outline 1 Sorting Algorithms (contd.) Outline Sorting Algorithms (contd.) 1 Sorting Algorithms (contd.) Analysis of Quicksort Time to sort array of length

More information

1 Divide and Conquer (September 3)

1 Divide and Conquer (September 3) The control of a large force is the same principle as the control of a few men: it is merely a question of dividing up their numbers. Sun Zi, The Art of War (c. 400 C.E.), translated by Lionel Giles (1910)

More information

Minimum Number of Experiments. Geoff Galgon, Garrett Ervin

Minimum Number of Experiments. Geoff Galgon, Garrett Ervin Minimum Number of Experiments Geoff Galgon, Garrett Ervin Abstract We give some examples of puzzles which are of the general form how few experiments are required to determine the unknown? We also discuss

More information

Analysis of Algorithms CMPSC 565

Analysis of Algorithms CMPSC 565 Analysis of Algorithms CMPSC 565 LECTURES 38-39 Randomized Algorithms II Quickselect Quicksort Running time Adam Smith L1.1 Types of randomized analysis Average-case analysis : Assume data is distributed

More information

Quick Sort Notes , Spring 2010

Quick Sort Notes , Spring 2010 Quick Sort Notes 18.310, Spring 2010 0.1 Randomized Median Finding In a previous lecture, we discussed the problem of finding the median of a list of m elements, or more generally the element of rank m.

More information

Sorting and Searching. Tony Wong

Sorting and Searching. Tony Wong Tony Wong 2017-03-04 Sorting Sorting is the reordering of array elements into a specific order (usually ascending) For example, array a[0..8] consists of the final exam scores of the n = 9 students in

More information

Randomized Sorting Algorithms Quick sort can be converted to a randomized algorithm by picking the pivot element randomly. In this case we can show th

Randomized Sorting Algorithms Quick sort can be converted to a randomized algorithm by picking the pivot element randomly. In this case we can show th CSE 3500 Algorithms and Complexity Fall 2016 Lecture 10: September 29, 2016 Quick sort: Average Run Time In the last lecture we started analyzing the expected run time of quick sort. Let X = k 1, k 2,...,

More information

CS 350 Algorithms and Complexity

CS 350 Algorithms and Complexity 1 CS 350 Algorithms and Complexity Fall 2015 Lecture 15: Limitations of Algorithmic Power Introduction to complexity theory Andrew P. Black Department of Computer Science Portland State University Lower

More information

N/4 + N/2 + N = 2N 2.

N/4 + N/2 + N = 2N 2. CS61B Summer 2006 Instructor: Erin Korber Lecture 24, 7 Aug. 1 Amortized Analysis For some of the data structures we ve discussed (namely hash tables and splay trees), it was claimed that the average time

More information

Quicksort. Where Average and Worst Case Differ. S.V. N. (vishy) Vishwanathan. University of California, Santa Cruz

Quicksort. Where Average and Worst Case Differ. S.V. N. (vishy) Vishwanathan. University of California, Santa Cruz Quicksort Where Average and Worst Case Differ S.V. N. (vishy) Vishwanathan University of California, Santa Cruz vishy@ucsc.edu February 1, 2016 S.V. N. Vishwanathan (UCSC) CMPS101 1 / 28 Basic Idea Outline

More information

CS361 Homework #3 Solutions

CS361 Homework #3 Solutions CS6 Homework # Solutions. Suppose I have a hash table with 5 locations. I would like to know how many items I can store in it before it becomes fairly likely that I have a collision, i.e., that two items

More information

CSE548, AMS542: Analysis of Algorithms, Fall 2017 Date: Oct 26. Homework #2. ( Due: Nov 8 )

CSE548, AMS542: Analysis of Algorithms, Fall 2017 Date: Oct 26. Homework #2. ( Due: Nov 8 ) CSE548, AMS542: Analysis of Algorithms, Fall 2017 Date: Oct 26 Homework #2 ( Due: Nov 8 ) Task 1. [ 80 Points ] Average Case Analysis of Median-of-3 Quicksort Consider the median-of-3 quicksort algorithm

More information

Divide and conquer. Philip II of Macedon

Divide and conquer. Philip II of Macedon Divide and conquer Philip II of Macedon Divide and conquer 1) Divide your problem into subproblems 2) Solve the subproblems recursively, that is, run the same algorithm on the subproblems (when the subproblems

More information

1 Terminology and setup

1 Terminology and setup 15-451/651: Design & Analysis of Algorithms August 31, 2017 Lecture #2 last changed: August 29, 2017 In this lecture, we will examine some simple, concrete models of computation, each with a precise definition

More information

Algorithms. Quicksort. Slide credit: David Luebke (Virginia)

Algorithms. Quicksort. Slide credit: David Luebke (Virginia) 1 Algorithms Quicksort Slide credit: David Luebke (Virginia) Sorting revisited We have seen algorithms for sorting: INSERTION-SORT, MERGESORT More generally: given a sequence of items Each item has a characteristic

More information

CS161: Algorithm Design and Analysis Recitation Section 3 Stanford University Week of 29 January, Problem 3-1.

CS161: Algorithm Design and Analysis Recitation Section 3 Stanford University Week of 29 January, Problem 3-1. CS161: Algorithm Design and Analysis Recitation Section 3 Stanford University Week of 29 January, 2018 Problem 3-1. (Quicksort Median-of-3 Partition) One way to improve the randomized quicksort procedure

More information

Data selection. Lower complexity bound for sorting

Data selection. Lower complexity bound for sorting Data selection. Lower complexity bound for sorting Lecturer: Georgy Gimel farb COMPSCI 220 Algorithms and Data Structures 1 / 12 1 Data selection: Quickselect 2 Lower complexity bound for sorting 3 The

More information

Outline. 1 Introduction. 3 Quicksort. 4 Analysis. 5 References. Idea. 1 Choose an element x and reorder the array as follows:

Outline. 1 Introduction. 3 Quicksort. 4 Analysis. 5 References. Idea. 1 Choose an element x and reorder the array as follows: Outline Computer Science 331 Quicksort Mike Jacobson Department of Computer Science University of Calgary Lecture #28 1 Introduction 2 Randomized 3 Quicksort Deterministic Quicksort Randomized Quicksort

More information

CS 350 Algorithms and Complexity

CS 350 Algorithms and Complexity CS 350 Algorithms and Complexity Winter 2019 Lecture 15: Limitations of Algorithmic Power Introduction to complexity theory Andrew P. Black Department of Computer Science Portland State University Lower

More information

Data Structures and Algorithms CSE 465

Data Structures and Algorithms CSE 465 Data Structures and Algorithms CSE 465 LECTURE 8 Analyzing Quick Sort Sofya Raskhodnikova and Adam Smith Reminder: QuickSort Quicksort an n-element array: 1. Divide: Partition the array around a pivot

More information

Sorting. Chapter 11. CSE 2011 Prof. J. Elder Last Updated: :11 AM

Sorting. Chapter 11. CSE 2011 Prof. J. Elder Last Updated: :11 AM Sorting Chapter 11-1 - Sorting Ø We have seen the advantage of sorted data representations for a number of applications q Sparse vectors q Maps q Dictionaries Ø Here we consider the problem of how to efficiently

More information

CS1800 Discrete Structures Spring 2018 February CS1800 Discrete Structures Midterm Version A

CS1800 Discrete Structures Spring 2018 February CS1800 Discrete Structures Midterm Version A CS1800 Discrete Structures Spring 2018 February 2018 CS1800 Discrete Structures Midterm Version A Instructions: 1. The exam is closed book and closed notes. You may not use a calculator or any other electronic

More information

Extended Algorithms Courses COMP3821/9801

Extended Algorithms Courses COMP3821/9801 NEW SOUTH WALES Extended Algorithms Courses Aleks Ignjatović School of Computer Science and Engineering University of New South Wales rithms What are we going to do in this class We will do: randomised

More information

IS 709/809: Computational Methods in IS Research Fall Exam Review

IS 709/809: Computational Methods in IS Research Fall Exam Review IS 709/809: Computational Methods in IS Research Fall 2017 Exam Review Nirmalya Roy Department of Information Systems University of Maryland Baltimore County www.umbc.edu Exam When: Tuesday (11/28) 7:10pm

More information

Recommended readings: Description of Quicksort in my notes, Ch7 of your CLRS text.

Recommended readings: Description of Quicksort in my notes, Ch7 of your CLRS text. Chapter 1 Quicksort 1.1 Prerequisites You need to be familiar with the divide-and-conquer paradigm, standard notations for expressing the time-complexity of an algorithm, like the big-oh, big-omega notations.

More information

Fundamental Algorithms

Fundamental Algorithms Chapter 2: Sorting, Winter 2018/19 1 Fundamental Algorithms Chapter 2: Sorting Jan Křetínský Winter 2018/19 Chapter 2: Sorting, Winter 2018/19 2 Part I Simple Sorts Chapter 2: Sorting, Winter 2018/19 3

More information

Fundamental Algorithms

Fundamental Algorithms Fundamental Algorithms Chapter 2: Sorting Harald Räcke Winter 2015/16 Chapter 2: Sorting, Winter 2015/16 1 Part I Simple Sorts Chapter 2: Sorting, Winter 2015/16 2 The Sorting Problem Definition Sorting

More information

Partition and Select

Partition and Select Divide-Conquer-Glue Algorithms Quicksort, Quickselect and the Master Theorem Quickselect algorithm Tyler Moore CSE 3353, SMU, Dallas, TX Lecture 11 Selection Problem: find the kth smallest number of an

More information

UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis

UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis Lecture 10 Class URL: http://vlsicad.ucsd.edu/courses/cse21-s14/ Lecture 10 Notes Midterm Good job overall! = 81; =

More information

Massachusetts Institute of Technology 6.042J/18.062J, Fall 02: Mathematics for Computer Science Professor Albert Meyer and Dr.

Massachusetts Institute of Technology 6.042J/18.062J, Fall 02: Mathematics for Computer Science Professor Albert Meyer and Dr. Massachusetts Institute of Technology 6.042J/18.062J, Fall 02: Mathematics for Computer Science Professor Albert Meyer and Dr. Radhika Nagpal Quiz 1 Appendix Appendix Contents 1 Induction 2 2 Relations

More information

Chapter 5. Divide and Conquer CLRS 4.3. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Chapter 5. Divide and Conquer CLRS 4.3. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. Chapter 5 Divide and Conquer CLRS 4.3 Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. 1 Divide-and-Conquer Divide-and-conquer. Break up problem into several parts. Solve

More information

Divide and Conquer Strategy

Divide and Conquer Strategy Divide and Conquer Strategy Algorithm design is more an art, less so a science. There are a few useful strategies, but no guarantee to succeed. We will discuss: Divide and Conquer, Greedy, Dynamic Programming.

More information

Design and Analysis of Algorithms

Design and Analysis of Algorithms CSE 101, Winter 2018 Design and Analysis of Algorithms Lecture 5: Divide and Conquer (Part 2) Class URL: http://vlsicad.ucsd.edu/courses/cse101-w18/ A Lower Bound on Convex Hull Lecture 4 Task: sort the

More information

CS Data Structures and Algorithm Analysis

CS Data Structures and Algorithm Analysis CS 483 - Data Structures and Algorithm Analysis Lecture VII: Chapter 6, part 2 R. Paul Wiegand George Mason University, Department of Computer Science March 22, 2006 Outline 1 Balanced Trees 2 Heaps &

More information

Algorithms. Jordi Planes. Escola Politècnica Superior Universitat de Lleida

Algorithms. Jordi Planes. Escola Politècnica Superior Universitat de Lleida Algorithms Jordi Planes Escola Politècnica Superior Universitat de Lleida 2016 Syllabus What s been done Formal specification Computational Cost Transformation recursion iteration Divide and conquer Sorting

More information

Lecture 1: Asymptotics, Recurrences, Elementary Sorting

Lecture 1: Asymptotics, Recurrences, Elementary Sorting Lecture 1: Asymptotics, Recurrences, Elementary Sorting Instructor: Outline 1 Introduction to Asymptotic Analysis Rate of growth of functions Comparing and bounding functions: O, Θ, Ω Specifying running

More information

1 Primals and Duals: Zero Sum Games

1 Primals and Duals: Zero Sum Games CS 124 Section #11 Zero Sum Games; NP Completeness 4/15/17 1 Primals and Duals: Zero Sum Games We can represent various situations of conflict in life in terms of matrix games. For example, the game shown

More information

CS 1110: Introduction to Computing Using Python Sequence Algorithms

CS 1110: Introduction to Computing Using Python Sequence Algorithms CS 1110: Introduction to Computing Using Python Lecture 22 Sequence Algorithms [Andersen, Gries, Lee, Marschner, Van Loan, White] Final Exam: Announcements May 18 th, 9am-11:30am Location: Barton Hall

More information

Chapter 5. Divide and Conquer CLRS 4.3. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Chapter 5. Divide and Conquer CLRS 4.3. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. Chapter 5 Divide and Conquer CLRS 4.3 Slides by Kevin Wayne. Copyright 25 Pearson-Addison Wesley. All rights reserved. Divide-and-Conquer Divide-and-conquer. Break up problem into several parts. Solve

More information

Kartsuba s Algorithm and Linear Time Selection

Kartsuba s Algorithm and Linear Time Selection CS 374: Algorithms & Models of Computation, Fall 2015 Kartsuba s Algorithm and Linear Time Selection Lecture 09 September 22, 2015 Chandra & Manoj (UIUC) CS374 1 Fall 2015 1 / 32 Part I Fast Multiplication

More information

Selection and Adversary Arguments. COMP 215 Lecture 19

Selection and Adversary Arguments. COMP 215 Lecture 19 Selection and Adversary Arguments COMP 215 Lecture 19 Selection Problems We want to find the k'th largest entry in an unsorted array. Could be the largest, smallest, median, etc. Ideas for an n lg n algorithm?

More information

CSE 431/531: Analysis of Algorithms. Dynamic Programming. Lecturer: Shi Li. Department of Computer Science and Engineering University at Buffalo

CSE 431/531: Analysis of Algorithms. Dynamic Programming. Lecturer: Shi Li. Department of Computer Science and Engineering University at Buffalo CSE 431/531: Analysis of Algorithms Dynamic Programming Lecturer: Shi Li Department of Computer Science and Engineering University at Buffalo Paradigms for Designing Algorithms Greedy algorithm Make a

More information

UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis

UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis Lecture 10 Class URL: http://vlsicad.ucsd.edu/courses/cse21-s14/ Lecture 10 Notes Midterm Good job overall! = 81; =

More information

Year 1: Fall. Year 1: Spring. HSB Topics - 2 Year Cycle

Year 1: Fall. Year 1: Spring. HSB Topics - 2 Year Cycle Year 1: Fall Pigeonhole 1 Pigeonhole 2 Induction 1 Induction 2 Inequalities 1 (AM-GM) Geometry 1 - Triangle Area Ratio Theorem (TART) Contest (Math Battle) Geometry 2 - Inscribed Quadrilaterals, Ptolemy

More information

The Inductive Proof Template

The Inductive Proof Template CS103 Handout 24 Winter 2016 February 5, 2016 Guide to Inductive Proofs Induction gives a new way to prove results about natural numbers and discrete structures like games, puzzles, and graphs. All of

More information

Advanced Analysis of Algorithms - Midterm (Solutions)

Advanced Analysis of Algorithms - Midterm (Solutions) Advanced Analysis of Algorithms - Midterm (Solutions) K. Subramani LCSEE, West Virginia University, Morgantown, WV {ksmani@csee.wvu.edu} 1 Problems 1. Solve the following recurrence using substitution:

More information

Concrete models and tight upper/lower bounds

Concrete models and tight upper/lower bounds Lecture 3 Concrete models and tight upper/lower bounds 3.1 Overview In this lecture, we will examine some simple, concrete models of computation, each with a precise definition of what counts as a step,

More information

Divide-and-conquer. Curs 2015

Divide-and-conquer. Curs 2015 Divide-and-conquer Curs 2015 The divide-and-conquer strategy. 1. Break the problem into smaller subproblems, 2. recursively solve each problem, 3. appropriately combine their answers. Known Examples: Binary

More information

Sorting Algorithms. We have already seen: Selection-sort Insertion-sort Heap-sort. We will see: Bubble-sort Merge-sort Quick-sort

Sorting Algorithms. We have already seen: Selection-sort Insertion-sort Heap-sort. We will see: Bubble-sort Merge-sort Quick-sort Sorting Algorithms We have already seen: Selection-sort Insertion-sort Heap-sort We will see: Bubble-sort Merge-sort Quick-sort We will show that: O(n log n) is optimal for comparison based sorting. Bubble-Sort

More information

Central Algorithmic Techniques. Iterative Algorithms

Central Algorithmic Techniques. Iterative Algorithms Central Algorithmic Techniques Iterative Algorithms Code Representation of an Algorithm class InsertionSortAlgorithm extends SortAlgorithm { void sort(int a[]) throws Exception { for (int i = 1; i < a.length;

More information

Problem Set 2 Solutions

Problem Set 2 Solutions Introduction to Algorithms October 1, 2004 Massachusetts Institute of Technology 6.046J/18.410J Professors Piotr Indyk and Charles E. Leiserson Handout 9 Problem Set 2 Solutions Reading: Chapters 5-9,

More information

Circuits. CSE 373 Data Structures

Circuits. CSE 373 Data Structures Circuits CSE 373 Data Structures Readings Reading Alas not in your book. So it won t be on the final! Circuits 2 Euler Euler (1707-1783): might be the most prolific mathematician of all times (analysis,

More information

5. DIVIDE AND CONQUER I

5. DIVIDE AND CONQUER I 5. DIVIDE AND CONQUER I mergesort counting inversions randomized quicksort median and selection closest pair of points Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley http://www.cs.princeton.edu/~wayne/kleinberg-tardos

More information

Exam Practice Problems

Exam Practice Problems Math 231 Exam Practice Problems WARNING: This is not a sample test. Problems on the exams may or may not be similar to these problems. These problems are just intended to focus your study of the topics.

More information

Question Paper Code :

Question Paper Code : www.vidyarthiplus.com Reg. No. : B.E./B.Tech. DEGREE EXAMINATION, NOVEMBER/DECEMBER 2011. Time : Three hours Fourth Semester Computer Science and Engineering CS 2251 DESIGN AND ANALYSIS OF ALGORITHMS (Regulation

More information

CS 580: Algorithm Design and Analysis

CS 580: Algorithm Design and Analysis CS 580: Algorithm Design and Analysis Jeremiah Blocki Purdue University Spring 2018 Announcement: Homework 1 due soon! Due: January 25 th at midnight (Blackboard) Recap: Graphs Bipartite Graphs Definition

More information

3.1 Induction: An informal introduction

3.1 Induction: An informal introduction Chapter 3 Induction and Recursion 3.1 Induction: An informal introduction This section is intended as a somewhat informal introduction to The Principle of Mathematical Induction (PMI): a theorem that establishes

More information

COMP 250: Quicksort. Carlos G. Oliver. February 13, Carlos G. Oliver COMP 250: Quicksort February 13, / 21

COMP 250: Quicksort. Carlos G. Oliver. February 13, Carlos G. Oliver COMP 250: Quicksort February 13, / 21 COMP 250: Quicksort Carlos G. Oliver February 13, 2018 Carlos G. Oliver COMP 250: Quicksort February 13, 2018 1 / 21 1 1 https://xkcd.com/1667/ Carlos G. Oliver COMP 250: Quicksort February 13, 2018 2

More information

CSE 613: Parallel Programming. Lecture 9 ( Divide-and-Conquer: Partitioning for Selection and Sorting )

CSE 613: Parallel Programming. Lecture 9 ( Divide-and-Conquer: Partitioning for Selection and Sorting ) CSE 613: Parallel Programming Lecture 9 ( Divide-and-Conquer: Partitioning for Selection and Sorting ) Rezaul A. Chowdhury Department of Computer Science SUNY Stony Brook Spring 2012 Parallel Partition

More information

CSCI 3110 Assignment 6 Solutions

CSCI 3110 Assignment 6 Solutions CSCI 3110 Assignment 6 Solutions December 5, 2012 2.4 (4 pts) Suppose you are choosing between the following three algorithms: 1. Algorithm A solves problems by dividing them into five subproblems of half

More information

Quicksort (CLRS 7) We previously saw how the divide-and-conquer technique can be used to design sorting algorithm Merge-sort

Quicksort (CLRS 7) We previously saw how the divide-and-conquer technique can be used to design sorting algorithm Merge-sort Quicksort (CLRS 7) We previously saw how the divide-and-conquer technique can be used to design sorting algorithm Merge-sort Partition n elements array A into two subarrays of n/2 elements each Sort the

More information

CSCE 750 Final Exam Answer Key Wednesday December 7, 2005

CSCE 750 Final Exam Answer Key Wednesday December 7, 2005 CSCE 750 Final Exam Answer Key Wednesday December 7, 2005 Do all problems. Put your answers on blank paper or in a test booklet. There are 00 points total in the exam. You have 80 minutes. Please note

More information

Divide and Conquer Algorithms

Divide and Conquer Algorithms Divide and Conquer Algorithms Introduction There exist many problems that can be solved using a divide-and-conquer algorithm. A divide-andconquer algorithm A follows these general guidelines. Divide Algorithm

More information

STEP Support Programme. Statistics STEP Questions: Solutions

STEP Support Programme. Statistics STEP Questions: Solutions STEP Support Programme Statistics STEP Questions: Solutions 200 S Q2 Preparation (i) (a) The sum of the probabilities is, so we have k + 2k + 3k + 4k k 0. (b) P(X 3) P(X 3) + P(X 4) 7 0. (c) E(X) 0 ( +

More information

CS 6783 (Applied Algorithms) Lecture 3

CS 6783 (Applied Algorithms) Lecture 3 CS 6783 (Applied Algorithms) Lecture 3 Antonina Kolokolova January 14, 2013 1 Representative problems: brief overview of the course In this lecture we will look at several problems which, although look

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LECTURE 5 Greedy Algorithms Interval Scheduling Interval Partitioning Guest lecturer: Martin Furer Review In a DFS tree of an undirected graph, can there be an edge (u,v)

More information

1 Closest Pair of Points on the Plane

1 Closest Pair of Points on the Plane CS 31: Algorithms (Spring 2019): Lecture 5 Date: 4th April, 2019 Topic: Divide and Conquer 3: Closest Pair of Points on a Plane Disclaimer: These notes have not gone through scrutiny and in all probability

More information

UNC Charlotte 2004 Algebra with solutions

UNC Charlotte 2004 Algebra with solutions with solutions March 8, 2004 1. Let z denote the real number solution to of the digits of z? (A) 13 (B) 14 (C) 15 (D) 16 (E) 17 3 + x 1 = 5. What is the sum Solution: E. Square both sides twice to get

More information

CS 580: Algorithm Design and Analysis. Jeremiah Blocki Purdue University Spring 2018

CS 580: Algorithm Design and Analysis. Jeremiah Blocki Purdue University Spring 2018 CS 580: Algorithm Design and Analysis Jeremiah Blocki Purdue University Spring 2018 Chapter 9 PSPACE: A Class of Problems Beyond NP Slides by Kevin Wayne. Copyright @ 2005 Pearson-Addison Wesley. All rights

More information

Algorithms, Design and Analysis. Order of growth. Table 2.1. Big-oh. Asymptotic growth rate. Types of formulas for basic operation count

Algorithms, Design and Analysis. Order of growth. Table 2.1. Big-oh. Asymptotic growth rate. Types of formulas for basic operation count Types of formulas for basic operation count Exact formula e.g., C(n) = n(n-1)/2 Algorithms, Design and Analysis Big-Oh analysis, Brute Force, Divide and conquer intro Formula indicating order of growth

More information

Divide-Conquer-Glue. Divide-Conquer-Glue Algorithm Strategy. Skyline Problem as an Example of Divide-Conquer-Glue

Divide-Conquer-Glue. Divide-Conquer-Glue Algorithm Strategy. Skyline Problem as an Example of Divide-Conquer-Glue Divide-Conquer-Glue Tyler Moore CSE 3353, SMU, Dallas, TX February 19, 2013 Portions of these slides have been adapted from the slides written by Prof. Steven Skiena at SUNY Stony Brook, author of Algorithm

More information

MITOCW Lec 11 MIT 6.042J Mathematics for Computer Science, Fall 2010

MITOCW Lec 11 MIT 6.042J Mathematics for Computer Science, Fall 2010 MITOCW Lec 11 MIT 6.042J Mathematics for Computer Science, Fall 2010 The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high

More information

Aside: Golden Ratio. Golden Ratio: A universal law. Golden ratio φ = lim n = 1+ b n = a n 1. a n+1 = a n + b n, a n+b n a n

Aside: Golden Ratio. Golden Ratio: A universal law. Golden ratio φ = lim n = 1+ b n = a n 1. a n+1 = a n + b n, a n+b n a n Aside: Golden Ratio Golden Ratio: A universal law. Golden ratio φ = lim n a n+b n a n = 1+ 5 2 a n+1 = a n + b n, b n = a n 1 Ruta (UIUC) CS473 1 Spring 2018 1 / 41 CS 473: Algorithms, Spring 2018 Dynamic

More information

SMT 2013 Power Round Solutions February 2, 2013

SMT 2013 Power Round Solutions February 2, 2013 Introduction This Power Round is an exploration of numerical semigroups, mathematical structures which appear very naturally out of answers to simple questions. For example, suppose McDonald s sells Chicken

More information

ICS 252 Introduction to Computer Design

ICS 252 Introduction to Computer Design ICS 252 fall 2006 Eli Bozorgzadeh Computer Science Department-UCI References and Copyright Textbooks referred [Mic94] G. De Micheli Synthesis and Optimization of Digital Circuits McGraw-Hill, 1994. [CLR90]

More information

Algorithms 6.5 REDUCTIONS. designing algorithms establishing lower bounds classifying problems intractability

Algorithms 6.5 REDUCTIONS. designing algorithms establishing lower bounds classifying problems intractability 6.5 REDUCTIONS Algorithms F O U R T H E D I T I O N designing algorithms establishing lower bounds classifying problems intractability R O B E R T S E D G E W I C K K E V I N W A Y N E Algorithms, 4 th

More information

CS 161: Design and Analysis of Algorithms

CS 161: Design and Analysis of Algorithms CS 161: Design and Analysis of Algorithms Greedy Algorithms 3: Minimum Spanning Trees/Scheduling Disjoint Sets, continued Analysis of Kruskal s Algorithm Interval Scheduling Disjoint Sets, Continued Each

More information

Data Structures and Algorithm Analysis (CSC317) Randomized Algorithms (part 3)

Data Structures and Algorithm Analysis (CSC317) Randomized Algorithms (part 3) Data Structures and Algorithm Analysis (CSC317) Randomized Algorithms (part 3) Quicksort p r Quicksort(A, p, r) 1. If p

More information

CS 5114: Theory of Algorithms. Tractable Problems. Tractable Problems (cont) Decision Problems. Clifford A. Shaffer. Spring 2014

CS 5114: Theory of Algorithms. Tractable Problems. Tractable Problems (cont) Decision Problems. Clifford A. Shaffer. Spring 2014 Department of Computer Science Virginia Tech Blacksburg, Virginia Copyright c 2014 by Clifford A. Shaffer : Theory of Algorithms Title page : Theory of Algorithms Clifford A. Shaffer Spring 2014 Clifford

More information

Lecture 18: P & NP. Revised, May 1, CLRS, pp

Lecture 18: P & NP. Revised, May 1, CLRS, pp Lecture 18: P & NP Revised, May 1, 2003 CLRS, pp.966-982 The course so far: techniques for designing efficient algorithms, e.g., divide-and-conquer, dynamic-programming, greedy-algorithms. What happens

More information

Algorithms. Algorithms 2.2 MERGESORT. mergesort bottom-up mergesort sorting complexity divide-and-conquer ROBERT SEDGEWICK KEVIN WAYNE

Algorithms. Algorithms 2.2 MERGESORT. mergesort bottom-up mergesort sorting complexity divide-and-conquer ROBERT SEDGEWICK KEVIN WAYNE Algorithms ROBERT SEDGEWICK KEVIN WAYNE 2.2 MERGESORT Algorithms F O U R T H E D I T I O N mergesort bottom-up mergesort sorting complexity divide-and-conquer ROBERT SEDGEWICK KEVIN WAYNE http://algs4.cs.princeton.edu

More information

CS Algorithms and Complexity

CS Algorithms and Complexity CS 50 - Algorithms and Complexity Linear Programming, the Simplex Method, and Hard Problems Sean Anderson 2/15/18 Portland State University Table of contents 1. The Simplex Method 2. The Graph Problem

More information

Introduction to Computer Science and Programming for Astronomers

Introduction to Computer Science and Programming for Astronomers Introduction to Computer Science and Programming for Astronomers Lecture 8. István Szapudi Institute for Astronomy University of Hawaii March 7, 2018 Outline Reminder 1 Reminder 2 3 4 Reminder We have

More information

Computability and Complexity Theory: An Introduction

Computability and Complexity Theory: An Introduction Computability and Complexity Theory: An Introduction meena@imsc.res.in http://www.imsc.res.in/ meena IMI-IISc, 20 July 2006 p. 1 Understanding Computation Kinds of questions we seek answers to: Is a given

More information

What is Probability? Probability. Sample Spaces and Events. Simple Event

What is Probability? Probability. Sample Spaces and Events. Simple Event What is Probability? Probability Peter Lo Probability is the numerical measure of likelihood that the event will occur. Simple Event Joint Event Compound Event Lies between 0 & 1 Sum of events is 1 1.5

More information

Reading and Writing. Mathematical Proofs. Slides by Arthur van Goetham

Reading and Writing. Mathematical Proofs. Slides by Arthur van Goetham Reading and Writing Mathematical Proofs Slides by Arthur van Goetham What is a proof? Why explanations are not proofs What is a proof? A method for establishing truth What establishes truth depends on

More information

Algorithms and Data Structures 2014 Exercises week 5

Algorithms and Data Structures 2014 Exercises week 5 Algorithms and Data Structures 014 Exercises week 5 October, 014 Exercises marked by ( ) are hard, but they might show up on the exam. Exercises marked by ( ) are even harder, but they will not be on the

More information

On my honor I affirm that I have neither given nor received inappropriate aid in the completion of this exercise.

On my honor I affirm that I have neither given nor received inappropriate aid in the completion of this exercise. CS 2413 Data Structures EXAM 1 Fall 2017, Page 1 of 10 Student Name: Student ID # OU Academic Integrity Pledge On my honor I affirm that I have neither given nor received inappropriate aid in the completion

More information

Chapter 4. Greedy Algorithms. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Chapter 4. Greedy Algorithms. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. Chapter 4 Greedy Algorithms Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. 1 4.1 Interval Scheduling Interval Scheduling Interval scheduling. Job j starts at s j and

More information

Big O 2/14/13. Administrative. Does it terminate? David Kauchak cs302 Spring 2013

Big O 2/14/13. Administrative. Does it terminate? David Kauchak cs302 Spring 2013 /4/3 Administrative Big O David Kauchak cs3 Spring 3 l Assignment : how d it go? l Assignment : out soon l CLRS code? l Videos Insertion-sort Insertion-sort Does it terminate? /4/3 Insertion-sort Loop

More information