MERGESORT BBM ALGORITHMS DEPT. OF COMPUTER ENGINEERING. Mergesort
|
|
- Alexis Summers
- 5 years ago
- Views:
Transcription
1 BBM ALGORITHMS DEPT. OF COMPUTER ENGINEERING Mergesort Basc plan. Dvde array nto two halves. Recursvely sort each half. Merge two halves. MERGESORT nput sort left half sort rght half merge results M E R G E S O R T E X A M P L E E E G M O R R S T E X A M P L E E E G M O R R S A E E L M P T X A E E E E G L M M O P R R S T X Mergesort overvew Acnowledgement: The course sldes are adapted from the sldes prepared by R. Sedgewc and K. Wayne of Prnceton Unversty. 2 Abstract n-place merge lo md md+1 h sorted sorted 3 4
2 Abstract n-place merge Abstract n-place merge lo md md+1 h copy to auxlary array 5 6 Abstract n-place merge Abstract n-place merge EA E G M R A C E R T compare mnmum n each subarray compare mnmum n each subarray E E G M R A C E R T 7 8
3 Abstract n-place merge Abstract n-place merge A E G M R A C E R T A EC G M R A C E R T compare mnmum n each subarray compare mnmum n each subarray 9 10 Abstract n-place merge Abstract n-place merge A C G M R A C E R T A C GE M R A C E R T compare mnmum n each subarray compare mnmum n each subarray 11 12
4 Abstract n-place merge Abstract n-place merge A C E M R A C E R T A C E ME R A C E R T compare mnmum n each subarray compare mnmum n each subarray Abstract n-place merge Abstract n-place merge A C E E R A C E R T A C E E RE A C E R T compare mnmum n each subarray compare mnmum n each subarray E E G M R A C E R T 15 16
5 Abstract n-place merge Abstract n-place merge A C E E E A C E R T A C E E E AG C E R T compare mnmum n each subarray compare mnmum n each subarray Abstract n-place merge Abstract n-place merge A C E E E G C E R T A C E E E G MC E R T compare mnmum n each subarray compare mnmum n each subarray 19 20
6 Abstract n-place merge Abstract n-place merge A C E E E G M E R T A C E E E G M ER R T compare mnmum n each subarray compare mnmum n each subarray Abstract n-place merge Abstract n-place merge A C E E E G M R R T A C E E E G M R R T one subarray exhausted, tae from other one subarray exhausted, tae from other 23 24
7 Abstract n-place merge Abstract n-place merge A C E E E G M R R T A C E E E G M R R T one subarray exhausted, tae from other one subarray exhausted, tae from other Abstract n-place merge Abstract n-place merge lo h A C E E E G M R R T A C E E E G M R R T both subarrays exhausted, done sorted 27 28
8 Mergng Q. How to combne two sorted subarrays nto a sorted whole. A. Use an auxlary array. Mergng: Java mplementaton prvate statc vod merge(comparable[] a, Comparable[] aux, nt lo, nt md, nt h) assert ssorted(a, lo, md); // precondton: a[lo..md] sorted assert ssorted(a, md+1, h); // precondton: a[md+1..h] sorted nput copy merged result A A C 0 7 E E G M R C E R T 2 A C E 1 7 E E G M R E R T 3 A C E E 2 7 E G M R E R T 4 A C E E E 2 8 G M R E R T 5 A C E E E G 3 8 G M R R T 6 A C E E E G M 4 8 M R R T 7 A C E E E G M R 5 8 R R T 8 A C E E E G M R R 5 9 R T 9 A C E E E G M R R T 6 10 T A C E E E G M R R T for (nt = lo; <= h; ++) aux[] = a[]; nt = lo, = md+1; for (nt = lo; <= h; ++) f ( > md) a[] = aux[++]; else f ( > h) a[] = aux[++]; else f (less(aux[], aux[])) a[] = aux[++]; else a[] = aux[++]; assert ssorted(a, lo, h); lo // postcondton: a[lo..h] sorted md A G L O R H I M S T h copy merge Abstract n-place merge trace A G H I L M Mergesort: Java mplementaton Mergesort: trace publc class Merge prvate statc vod merge(comparable[] a, Comparable[] aux, nt lo, nt md, nt h) /* as before */ prvate statc vod sort(comparable[] a, Comparable[] aux, nt lo, nt h) f (h <= lo) return; nt md = lo + (h - lo) / 2; sort (a, aux, lo, md); sort (a, aux, md+1, h); merge(a, aux, lo, md, h); publc statc vod sort(comparable[] a) aux = new Comparable[a.length]; sort(a, aux, 0, a.length - 1); lo h merge(a, 0, 0, 1) merge(a, 2, 2, 3) merge(a, 0, 1, 3) merge(a, 4, 4, 5) merge(a, 6, 6, 7) merge(a, 4, 5, 7) merge(a, 0, 3, 7) merge(a, 8, 8, 9) merge(a, 10, 10, 11) merge(a, 8, 9, 11) merge(a, 12, 12, 13) merge(a, 14, 14, 15) merge(a, 12, 13, 15) merge(a, 8, 11, 15) merge(a, 0, 7, 15) M E R G E S O R T E X A M P L E E M R G E S O R T E X A M P L E E M G R E S O R T E X A M P L E E G M R E S O R T E X A M P L E E G M R E S O R T E X A M P L E E G M R E S O R T E X A M P L E E G M R E O R S T E X A M P L E E E G M O R R S T E X A M P L E E E G M O R R S E T X A M P L E E E G M O R R S E T A X M P L E E E G M O R R S A E T X M P L E E E G M O R R S A E T X M P L E E E G M O R R S A E T X M P E L E E G M O R R S A E T X E L M P E E G M O R R S A E E L M P T X A E E E E G L M M O P R R S T X Trace of merge results for top-down mergesort lo md h result after recursve call
9 Mergesort: anmaton Mergesort: anmaton 50 random tems 50 reverse-sorted tems algorthm poston algorthm poston n order current subarray n order current subarray not n order not n order Mergesort: emprcal analyss Runnng tme estmates: Laptop executes 10 8 compares/second. Supercomputer executes compares/second. nserton sort (N 2 ) mergesort (N log N) computer thousand mllon bllon thousand mllon bllon Mergesort: number of compares and array accesses Proposton. Mergesort uses at most N lg N compares and 6 N lg N array accesses to sort any array of sze N. Pf setch. The number of compares C (N) and array accesses A (N) to mergesort an array of sze N satsfy the recurrences: C (N) C ( N / 2 ) + C ( N / 2 ) + N for N > 1, wth C (1) = 0. home nstant 2.8 hours 317 years nstant 1 second 18 mn super nstant 1 second 1 wee nstant nstant nstant left half rght half merge A (N) A ( N / 2 ) + A ( N / 2 ) + 6 N for N > 1, wth A (1) = 0. We solve the recurrence when N s a power of 2. Bottom lne. Good algorthms are better than supercomputers. D (N) = 2 D (N / 2) + N, for N > 1, wth D (1) =
10 Mergng: Java mplementaton prvate statc vod merge(comparable[] a, Comparable[] aux, nt lo, nt md, nt h) assert ssorted(a, lo, md); // precondton: a[lo..md] sorted assert ssorted(a, md+1, h); // precondton: a[md+1..h] sorted for (nt = lo; <= h; ++) aux[] = a[]; nt = lo, = md+1; for (nt = lo; <= h; ++) f ( > md) a[] = aux[++]; else f ( > h) a[] = aux[++]; else f (less(aux[], aux[])) a[] = aux[++]; else a[] = aux[++]; 2N assert ssorted(a, lo, h); 2N // postcondton: a[lo..h] sorted copy merge 2N Dvde-and-conquer recurrence: proof by pcture lg N Proposton. If D (N) satsfes D (N) = 2 D (N / 2) + N for N > 1, wth D (1) = 0, then D (N) = N lg N. Pf 1. [assumng N s a power of 2] D (N / 2) D (N / 4) D (N / 4) D (N) D (N / 2 ) D (N / 4) D (N / 2) D (N / 4) N 2 (N/2)... 2 (N/2 ) = N = N 4 (N/4) = N... = N D (2) D (2) D (2) D (2) D (2) D (2) D (2) D (2) N/2 (2) = N N lg N Dvde-and-conquer recurrence: proof by expanson Proposton. If D (N) satsfes D (N) = 2 D (N / 2) + N for N > 1, wth D (1) = 0, then D (N) = N lg N. Pf 2. [assumng N s a power of 2] D (N) = 2 D (N/2) + N D (N) / N = 2 D (N/2) / N + 1 = D (N/2) / (N/2) + 1 = D (N/4) / (N/4) = D (N/8) / (N/8) = D (N/N) / (N/N) = lg N gven dvde both sdes by N algebra apply to frst term apply to frst term agan stop applyng, D(1) = 0 Dvde-and-conquer recurrence: proof by nducton Proposton. If D (N) satsfes D (N) = 2 D (N / 2) + N for N > 1, wth D (1) = 0, then D (N) = N lg N. Pf 3. [assumng N s a power of 2] Base case: N = 1. Inductve hypothess: D (N) = N lg N. Goal: show that D (2N) = (2N) lg (2N). D (2N) = 2 D (N) + 2N = 2 N lg N + 2N = 2 N (lg (2N) 1) + 2N = 2 N lg (2N) gven nductve hypothess algebra QED 39 40
11 Mergesort analyss: memory Proposton. Mergesort uses extra space proportonal to N. Pf. The array needs to be of sze N for the last merge. Mergesort: practcal mprovements Use nserton sort for small subarrays. Mergesort has too much overhead for tny subarrays. Cutoff to nserton sort for 7 tems. two sorted subarrays A C D G H I M N U V B E F J O P Q R S T A B C D E F G H I J M N O P Q R S T U V merged result Def. A sortng algorthm s n-place f t uses c log N extra memory. Ex. Inserton sort, selecton sort, shellsort. Challenge for the bored. In-place merge. [Kronrod, 1969] prvate statc vod sort(comparable[] a, Comparable[] aux, nt lo, nt h) f (h <= lo + CUTOFF - 1) Inserton.sort(a, lo, h); nt md = lo + (h - lo) / 2; sort (a, aux, lo, md); sort (a, aux, md+1, h); merge(a, aux, lo, md, h); Mergesort: practcal mprovements Stop f already sorted. Is bggest tem n frst half smallest tem n second half? Helps for partally-ordered arrays. Mergesort: practcal mprovements Elmnate the copy to the auxlary array. Save tme (but not space) by swtchng the role of the nput and auxlary array n each recursve call. A B C D E F G H I J M N O P Q R S T U V A B C D E F G H I J M N O P Q R S T U V prvate statc vod sort(comparable[] a, Comparable[] aux, nt lo, nt h) f (h <= lo) return; nt md = lo + (h - lo) / 2; sort (a, aux, lo, md); sort (a, aux, md+1, h); f (!less(a[md+1], a[md])) return; merge(a, aux, lo, md, h); prvate statc vod merge(comparable[] a, Comparable[] aux, nt lo, nt md, nt h) nt = lo, = md+1; for (nt = lo; <= h; ++) f ( > md) aux[] = a[++]; else f ( > h) aux[] = a[++]; else f (less(a[], a[])) aux[] = a[++]; merge from to else aux[] = a[++]; prvate statc vod sort(comparable[] a, Comparable[] aux, nt lo, nt h) f (h <= lo) return; nt md = lo + (h - lo) / 2; sort (aux, a, lo, md); sort (aux, a, md+1, h); merge(aux, a, lo, md, h); 43 swtch roles of and 44
12 Mergesort: vsualzaton Bottom-up mergesort frst subarray second subarray frst merge frst half sorted Basc plan. Pass through array, mergng subarrays of sze 1. Repeat for subarrays of sze 2, 4, 8, 16,... sz = 1 merge(a, 0, 0, 1) merge(a, 2, 2, 3) merge(a, 4, 4, 5) merge(a, 6, 6, 7) merge(a, 8, 8, 9) merge(a, 10, 10, 11) merge(a, 12, 12, 13) merge(a, 14, 14, 15) sz = 2 merge(a, 0, 1, 3) merge(a, 4, 5, 7) merge(a, 8, 9, 11) merge(a, 12, 13, 15) sz = 4 merge(a, 0, 3, 7) merge(a, 8, 11, 15) sz = 8 merge(a, 0, 7, 15) a[] M E R G E S O R T E X A M P L E E M R G E S O R T E X A M P L E E M G R E S O R T E X A M P L E E M G R E S O R T E X A M P L E E M G R E S O R T E X A M P L E E M G R E S O R E T X A M P L E E M G R E S O R E T A X M P L E E M G R E S O R E T A X M P L E E M G R E S O R E T A X M P E L E G M R E S O R E T A X M P E L E G M R E O R S E T A X M P E L E G M R E O R S A E T X M P E L E G M R E O R S A E T X E L M P E E G M O R R S A E T X E L M P E E G M O R R S A E E L M P T X A E E E E G L M M O P R R S T X Trace of merge results for bottom-up mergesort second half sorted result 45 Bottom lne. No recurson needed! 46 Bottom-up mergesort: Java mplementaton Bottom-up mergesort: vsual trace publc class MergeBU prvate statc Comparable[] aux; prvate statc vod merge(comparable[] a, nt lo, nt md, nt h) /* as before */ publc statc vod sort(comparable[] a) nt N = a.length; aux = new Comparable[N]; for (nt sz = 1; sz < N; sz = sz+sz) for (nt lo = 0; lo < N-sz; lo += sz+sz) merge(a, lo, lo+sz-1, Math.mn(lo+sz+sz-1, N-1)); Bottom lne. Concse ndustral-strength code, f you have the space
13 Bottom-up mergesort: vsual trace Bottom-up mergesort: vsual trace Complexty of sortng Decson tree (for 3 dstnct tems a, b, and c) Computatonal complexty. Framewor to study effcency of algorthms for solvng a partcular problem X. Model of computaton. Allowable operatons. Cost model. Operaton count(s). Upper bound. Cost guarantee provded by some algorthm for X. Lower bound. Proven lmt on cost guarantee of all algorthms for X. Optmal algorthm. Algorthm wth best possble cost guarantee for X. yes b < c a < b yes no code between compares (e.g., sequence of exchanges) no yes a < c no heght of tree = worst-case number of Example: sortng. Model of computaton: decson tree. Cost model: # compares. Upper bound: ~ N lg N from mergesort. Lower bound:? Optmal algorthm:? lower bound ~ upper bound can access nformaton only through compares (e.g., Java Comparable framewor) a b c yes a c b a < c no c a b b a c yes b c a b < c no c b a 51 (at least) one leaf for each possble orderng 52
14 Compare-based lower bound for sortng Proposton. Any compare-based sortng algorthm must use at least lg ( N! ) ~ N lg N compares n the worst-case. Pf. Assume array conssts of N dstnct values a1 through an. Worst case dctated by heght h of decson tree. Bnary tree of heght h has at most 2 h leaves. N! dfferent orderngs at least N! leaves. Compare-based lower bound for sortng Proposton. Any compare-based sortng algorthm must use at least lg ( N! ) ~ N lg N compares n the worst-case. Pf. Assume array conssts of N dstnct values a1 through an. Worst case dctated by heght h of decson tree. Bnary tree of heght h has at most 2 h leaves. N! dfferent orderngs at least N! leaves. h 2 h # leaves N! h lg ( N! ) ~ N lg N Strlng's formula at least N! leaves no more than 2 h leaves Complexty of sortng Model of computaton. Allowable operatons. Cost model. Operaton count(s). Upper bound. Cost guarantee provded by some algorthm for X. Lower bound. Proven lmt on cost guarantee of all algorthms for X. Optmal algorthm. Algorthm wth best possble cost guarantee for X. Example: sortng. Model of computaton: decson tree. Cost model: # compares. Upper bound: ~ N lg N from mergesort. Lower bound: ~ N lg N. Optmal algorthm = mergesort. Frst goal of algorthm desgn: optmal algorthms. Complexty results n context Other operatons? Mergesort s optmal wth respect to number of compares (e.g., but not wth respect to number of array accesses). Space? Mergesort s not optmal wth respect to space usage. Inserton sort, selecton sort, and shellsort are space-optmal. Challenge. Fnd an algorthm that s both tme- and space-optmal. [stay tuned] Lessons. Use theory as a gude. Ex. Don't try to desgn sortng algorthm that guarantees ½ N lg N compares
15 Complexty results n context (contnued) Lower bound may not hold f the algorthm has nformaton about: The ntal order of the nput. The dstrbuton of ey values. The representaton of the eys. Comparable nterface: revew Comparable nterface: sort usng a type's natural order. publc class Date mplements Comparable<Date> prvate fnal nt month, day, year; Partally-ordered arrays. Dependng on the ntal order of the nput, we may not need N lg N compares. nserton sort requres only N-1 compares f nput array s sorted Duplcate eys. Dependng on the nput dstrbuton of duplcates, we may not need N lg N compares. stay tuned for 3-way qucsort Dgtal propertes of eys. We can use dgt/character compares nstead of ey compares for numbers and strngs. stay tuned for radx sorts publc Date(nt m, nt d, nt y) month = m; day = d; year = y; publc nt compareto(date that) f (ths.year < that.year ) return -1; f (ths.year > that.year ) return +1; f (ths.month < that.month) return -1; f (ths.month > that.month) return +1; f (ths.day < that.day ) return -1; f (ths.day > that.day ) return +1; return 0; natural order Comparator nterface Comparator nterface: system sort Comparator nterface: sort usng an alternate order. publc nterface Comparator<Key> To use wth Java system sort: Create Comparator obect. Pass as second argument to Arrays.sort(). Requred property. Must be a total order. Ex. Sort strngs by: Natural order. Case nsenstve. Spansh. Brtsh phone boo.... nt compare(key v, Key w) compare eys v and w pre-1994 order for dgraphs ch and ll and rr Now s the tme s Now the tme café cafetero cuarto churro nube ñoño McKnley Macntosh 59 Strng[] a;... Arrays.sort(a);... uses natural order uses alternate order defned by Comparator<Strng> obect Arrays.sort(a, Strng.CASE_INSENSITIVE_ORDER);... Arrays.sort(a, Collator.getInstance(new Locale("es")));... Arrays.sort(a, new BrtshPhoneBooOrder());... Bottom lne. Decouples the defnton of the data type from the defnton of what t means to compare two obects of that type. 60
16 Comparator nterface: usng wth our sortng lbrares To support comparators n our sort mplementatons: Use Obect nstead of Comparable. Pass Comparator to sort() and less() and use t n less(). Comparator nterface: mplementng To mplement a comparator: Defne a (nested) class that mplements the Comparator nterface. Implement the compare() method. nserton sort usng a Comparator publc statc vod sort(obect[] a, Comparator comparator) nt N = a.length; for (nt = 0; < N; ++) for (nt = ; > 0 && less(comparator, a[], a[-1]); --) exch(a,, -1); prvate statc boolean less(comparator c, Obect v, Obect w) return c.compare(v, w) < 0; prvate statc vod exch(obect[] a, nt, nt ) Obect swap = a[]; a[] = a[]; a[] = swap; publc class Student publc statc fnal Comparator<Student> BY_NAME = new ByName(); publc statc fnal Comparator<Student> BY_SECTION = new BySecton(); prvate fnal Strng name; prvate fnal nt secton;... one Comparator for the class prvate statc class ByName mplements Comparator<Student> publc nt compare(student v, Student w) return v.name.compareto(w.name); prvate statc class BySecton mplements Comparator<Student> publc nt compare(student v, Student w) return v.secton - w.secton; ths technque wors here snce no danger of overflow Comparator nterface: mplementng To mplement a comparator: Defne a (nested) class that mplements the Comparator nterface. Implement the compare() method. Stablty A typcal applcaton. Frst, sort by name; then sort by secton. Selecton.sort(a, Student.BY_NAME); Selecton.sort(a, Student.BY_SECTION); Andrews 3 A Lttle Fura 1 A Brown Battle 4 C Whtman Rohde 2 A Forbes Chen 3 A Blar Chen 3 A Blar Arrays.sort(a, Student.BY_NAME); Arrays.sort(a, Student.BY_SECTION); Fox 3 A Dcnson Fox 3 A Dcnson Andrews 3 A Lttle Fura 1 A Brown Fura 1 A Brown Andrews 3 A Lttle Battle 4 C Whtman Chen 3 A Blar Fox 3 A Dcnson Rohde 2 A Forbes Andrews 3 A Lttle Chen 3 A Blar Gazs 4 B Brown Kanaga 3 B Brown Rohde 2 A Forbes Kanaga 3 B Brown Gazs 4 B Brown Battle 4 C Whtman Fura 1 A Brown Fox 3 A Dcnson Gazs 4 B Brown Kanaga 3 B Brown Rohde 2 A Forbes Kanaga 3 B Brown Battle 4 C Whtman Gazs 4 B Students n secton 3 no longer sorted by name. A stable sort preserves the relatve order of tems wth equal eys
17 Stablty Q. Whch sorts are stable? A. Inserton sort and mergesort (but not selecton sort or shellsort). sorted by tme sorted by locaton (not stable) sorted by locaton (stable) Chcago 09:00:00 Phoenx 09:00:03 Houston 09:00:13 Chcago 09:00:59 Houston 09:01:10 Chcago 09:03:13 Seattle 09:10:11 Seattle 09:10:25 Phoenx 09:14:25 Chcago 09:19:32 Chcago 09:19:46 Chcago 09:21:05 Seattle 09:22:43 Seattle 09:22:54 Chcago 09:25:52 Chcago 09:35:21 Seattle 09:36:14 Phoenx 09:37:44 Chcago 09:25:52 Chcago 09:03:13 Chcago 09:21:05 Chcago 09:19:46 Chcago 09:19:32 Chcago 09:00:00 Chcago 09:35:21 Chcago 09:00:59 Houston 09:01:10 Houston 09:00:13 Phoenx 09:37:44 Phoenx 09:00:03 Phoenx 09:14:25 Seattle 09:10:25 Seattle 09:36:14 Seattle 09:22:43 Seattle 09:10:11 Seattle 09:22:54 no longer sorted by tme Chcago 09:00:00 Chcago 09:00:59 Chcago 09:03:13 Chcago 09:19:32 Chcago 09:19:46 Chcago 09:21:05 Chcago 09:25:52 Chcago 09:35:21 Houston 09:00:13 Houston 09:01:10 Phoenx 09:00:03 Phoenx 09:14:25 Phoenx 09:37:44 Seattle 09:10:11 Seattle 09:10:25 Seattle 09:22:43 Seattle 09:22:54 Seattle 09:36:14 stll sorted by tme Stablty: nserton sort Proposton. Inserton sort s stable. publc class Inserton publc statc vod sort(comparable[] a) nt N = a.length; for (nt = 0; < N; ++) for (nt = ; > 0 && less(a[], a[-1]); --) exch(a,, -1); B1 A1 A2 A3 B2 1 0 A1 B1 A2 A3 B2 2 1 A1 A2 B1 A3 B2 3 2 A1 A2 A3 B1 B2 4 4 A1 A2 A3 B1 B2 Note. Need to carefully chec code ("less than" vs "less than or equal to"). A1 A2 A3 B1 B2 Pf. Equal tems never move past each other Stablty: selecton sort Proposton. Selecton sort s not stable. Stablty: shellsort Proposton. Shellsort sort s not stable. publc class Selecton publc statc vod sort(comparable[] a) nt N = a.length; for (nt = 0; < N; ++) nt mn = ; for (nt = +1; < N; ++) f (less(a[], a[mn])) mn = ; exch(a,, mn); mn B1 B2 A 1 1 A B2 B1 2 2 A B2 B1 A B2 B1 publc class Shell publc statc vod sort(comparable[] a) nt N = a.length; nt h = 1; whle (h < N/3) h = 3*h + 1; whle (h >= 1) for (nt = h; < N; ++) for (nt = ; > h && less(a[], a[-h]); -= h) exch(a,, -h); h h = h/3; B1 B2 B3 B4 A1 4 A1 B2 B3 B4 B1 Pf by counterexample. Long-dstance exchange mght move an tem past some equal tem. Pf by counterexample. Long-dstance exchanges. 1 A1 B2 B3 B4 B1 A1 B2 B3 B4 B
18 Stablty: mergesort Proposton. Mergesort s stable. Stablty: mergesort Proposton. Merge operaton s stable. publc class Merge prvate statc Comparable[] aux; prvate statc vod merge(comparable[] a, nt lo, nt md, nt h) /* as before */ prvate statc vod merge(comparable[] a, nt lo, nt md, nt h) for (nt = lo; <= h; ++) aux[] = a[]; prvate statc vod sort(comparable[] a, nt lo, nt h) f (h <= lo) return; nt md = lo + (h - lo) / 2; sort(a, lo, md); sort(a, md+1, h); merge(a, lo, md, h); nt = lo, = md+1; for (nt = lo; <= h; ++) f ( > md) a[] = aux[++]; else f ( > h) a[] = aux[++]; else f (less(aux[], aux[])) a[] = aux[++]; else a[] = aux[++]; publc statc vod sort(comparable[] a) /* as before */ A1 A2 A3 B D A4 A5 C E F G Pf. Suffces to verfy that merge operaton s stable. Pf. Taes from left subarray f equal eys
MERGESORT BBM ALGORITHMS DEPT. OF COMPUTER ENGINEERING ERKUT ERDEM. Mergesort. Feb. 27, 2014
ergesort BB 202 - ALGOITHS Basc plan. Dvde array nto two halves. ecursvely sort each half. erge two halves. DPT. OF COPUT NGINING KUT D GSOT nput G S O T X A P L sort left half G O S T X A P L sort rght
More informationAlgorithms. Algorithms. Algorithms 2.2 M ERGESORT. mergesort bottom-up mergesort. sorting complexity divide-and-conquer
Algorthms Two classc sortng algorthms: mergesort and qucsort R OBERT S EDGEWICK K EVIN W AYNE Crtcal components n the world s computatonal nfrastructure. Full scentfc understandng of ther propertes has
More informationELEMENTARY SORTING ALGORITHMS
BBM 202 - ALGORITHMS DEPT. OF COMPUTER ENGINEERING ELEMENTARY SORTING ALGORITHMS Feb. 20, 2017 Acknowledgement: The course sldes are adapted from the sldes prepared by R. Sedgewck and K. Wayne of Prnceton
More informationAlgorithms. 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 informationMath Review. CptS 223 Advanced Data Structures. Larry Holder School of Electrical Engineering and Computer Science Washington State University
Math Revew CptS 223 dvanced Data Structures Larry Holder School of Electrcal Engneerng and Computer Scence Washngton State Unversty 1 Why do we need math n a data structures course? nalyzng data structures
More informationSORTING ALGORITHMS BBM ALGORITHMS DEPT. OF COMPUTER ENGINEERING ERKUT ERDEM. Mar. 21, 2013
BBM 202 - ALGORITHMS DPT. OF COMPUTR NGINRING RKUT RDM SORTING ALGORITHMS Mar. 21, 2013 Acknowledgement: The course slides are adapted from the slides prepared by R. Sedgewick and K. Wayne of Princeton
More informationCalculation of time complexity (3%)
Problem 1. (30%) Calculaton of tme complexty (3%) Gven n ctes, usng exhaust search to see every result takes O(n!). Calculaton of tme needed to solve the problem (2%) 40 ctes:40! dfferent tours 40 add
More informationOutline and Reading. Dynamic Programming. Dynamic Programming revealed. Computing Fibonacci. The General Dynamic Programming Technique
Outlne and Readng Dynamc Programmng The General Technque ( 5.3.2) -1 Knapsac Problem ( 5.3.3) Matrx Chan-Product ( 5.3.1) Dynamc Programmng verson 1.4 1 Dynamc Programmng verson 1.4 2 Dynamc Programmng
More informationOutline. 1 Merging. 2 Merge Sort. 3 Complexity of Sorting. 4 Merge Sort and Other Sorts 2 / 10
Merge Sort 1 / 10 Outline 1 Merging 2 Merge Sort 3 Complexity of Sorting 4 Merge Sort and Other Sorts 2 / 10 Merging Merge sort is based on a simple operation known as merging: combining two ordered arrays
More informationModule 3 LOSSY IMAGE COMPRESSION SYSTEMS. Version 2 ECE IIT, Kharagpur
Module 3 LOSSY IMAGE COMPRESSION SYSTEMS Verson ECE IIT, Kharagpur Lesson 6 Theory of Quantzaton Verson ECE IIT, Kharagpur Instructonal Objectves At the end of ths lesson, the students should be able to:
More informationCS 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 informationCS 770G - Parallel Algorithms in Scientific Computing
References CS 770G - Parallel Algorthms n Scentfc Computng Parallel Sortng Introducton to Parallel Computng Kumar, Grama, Gupta, Karyps, Benjamn Cummngs. A porton of the notes comes from Prof. J. Demmel
More informationSorting Algorithms. !rules of the game!shellsort!mergesort!quicksort!animations. Classic sorting algorithms
Classic sorting algorithms Sorting Algorithms!rules of the game!shellsort!mergesort!quicksort!animations Reference: Algorithms in Java, Chapters 6-8 1 Critical components in the world s computational infrastructure.
More informationCHAPTER 17 Amortized Analysis
CHAPTER 7 Amortzed Analyss In an amortzed analyss, the tme requred to perform a sequence of data structure operatons s averaged over all the operatons performed. It can be used to show that the average
More informationDynamic Programming! CSE 417: Algorithms and Computational Complexity!
Dynamc Programmng CSE 417: Algorthms and Computatonal Complexty Wnter 2009 W. L. Ruzzo Dynamc Programmng, I:" Fbonacc & Stamps Outlne: General Prncples Easy Examples Fbonacc, Lckng Stamps Meater examples
More informationDesign and Analysis of Algorithms
Desgn and Analyss of Algorthms CSE 53 Lecture 4 Dynamc Programmng Junzhou Huang, Ph.D. Department of Computer Scence and Engneerng CSE53 Desgn and Analyss of Algorthms The General Dynamc Programmng Technque
More informationDynamic Programming. Preview. Dynamic Programming. Dynamic Programming. Dynamic Programming (Example: Fibonacci Sequence)
/24/27 Prevew Fbonacc Sequence Longest Common Subsequence Dynamc programmng s a method for solvng complex problems by breakng them down nto smpler sub-problems. It s applcable to problems exhbtng the propertes
More informationVQ widely used in coding speech, image, and video
at Scalar quantzers are specal cases of vector quantzers (VQ): they are constraned to look at one sample at a tme (memoryless) VQ does not have such constrant better RD perfomance expected Source codng
More informationExercises. 18 Algorithms
18 Algorthms Exercses 0.1. In each of the followng stuatons, ndcate whether f = O(g), or f = Ω(g), or both (n whch case f = Θ(g)). f(n) g(n) (a) n 100 n 200 (b) n 1/2 n 2/3 (c) 100n + log n n + (log n)
More informationLecture 4. Instructor: Haipeng Luo
Lecture 4 Instructor: Hapeng Luo In the followng lectures, we focus on the expert problem and study more adaptve algorthms. Although Hedge s proven to be worst-case optmal, one may wonder how well t would
More informationLearning Theory: Lecture Notes
Learnng Theory: Lecture Notes Lecturer: Kamalka Chaudhur Scrbe: Qush Wang October 27, 2012 1 The Agnostc PAC Model Recall that one of the constrants of the PAC model s that the data dstrbuton has to be
More informationAdvanced Algebraic Algorithms on Integers and Polynomials
Advanced Algebrac Algorthms on Integers and Polynomals Analyss of Algorthms Prepared by John Ref, Ph.D. Integer and Polynomal Computatons a) Newton Iteraton: applcaton to dvson b) Evaluaton and Interpolaton
More informationHomework 9 Solutions. 1. (Exercises from the book, 6 th edition, 6.6, 1-3.) Determine the number of distinct orderings of the letters given:
Homework 9 Solutons PROBLEM ONE 1 (Exercses from the book, th edton,, 1-) Determne the number of dstnct orderngs of the letters gven: (a) GUIDE Soluton: 5! (b) SCHOOL Soluton:! (c) SALESPERSONS Soluton:
More informationErrors for Linear Systems
Errors for Lnear Systems When we solve a lnear system Ax b we often do not know A and b exactly, but have only approxmatons  and ˆb avalable. Then the best thng we can do s to solve ˆx ˆb exactly whch
More informationIntroduction to information theory and data compression
Introducton to nformaton theory and data compresson Adel Magra, Emma Gouné, Irène Woo March 8, 207 Ths s the augmented transcrpt of a lecture gven by Luc Devroye on March 9th 207 for a Data Structures
More informationCommon loop optimizations. Example to improve locality. Why Dependence Analysis. Data Dependence in Loops. Goal is to find best schedule:
15-745 Lecture 6 Data Dependence n Loops Copyrght Seth Goldsten, 2008 Based on sldes from Allen&Kennedy Lecture 6 15-745 2005-8 1 Common loop optmzatons Hostng of loop-nvarant computatons pre-compute before
More informationAppendix B: Resampling Algorithms
407 Appendx B: Resamplng Algorthms A common problem of all partcle flters s the degeneracy of weghts, whch conssts of the unbounded ncrease of the varance of the mportance weghts ω [ ] of the partcles
More informationLecture 4: November 17, Part 1 Single Buffer Management
Lecturer: Ad Rosén Algorthms for the anagement of Networs Fall 2003-2004 Lecture 4: November 7, 2003 Scrbe: Guy Grebla Part Sngle Buffer anagement In the prevous lecture we taled about the Combned Input
More informationIntroduction to Algorithms
Introducton to Algorthms 6.046J/8.40J Lecture 7 Prof. Potr Indyk Data Structures Role of data structures: Encapsulate data Support certan operatons (e.g., INSERT, DELETE, SEARCH) Our focus: effcency of
More informationWeek 5: Neural Networks
Week 5: Neural Networks Instructor: Sergey Levne Neural Networks Summary In the prevous lecture, we saw how we can construct neural networks by extendng logstc regresson. Neural networks consst of multple
More informationStructure and Drive Paul A. Jensen Copyright July 20, 2003
Structure and Drve Paul A. Jensen Copyrght July 20, 2003 A system s made up of several operatons wth flow passng between them. The structure of the system descrbes the flow paths from nputs to outputs.
More informationHashing. Alexandra Stefan
Hashng Alexandra Stefan 1 Hash tables Tables Drect access table (or key-ndex table): key => ndex Hash table: key => hash value => ndex Man components Hash functon Collson resoluton Dfferent keys mapped
More informationEconomics 101. Lecture 4 - Equilibrium and Efficiency
Economcs 0 Lecture 4 - Equlbrum and Effcency Intro As dscussed n the prevous lecture, we wll now move from an envronment where we looed at consumers mang decsons n solaton to analyzng economes full of
More informationNumerical Heat and Mass Transfer
Master degree n Mechancal Engneerng Numercal Heat and Mass Transfer 06-Fnte-Dfference Method (One-dmensonal, steady state heat conducton) Fausto Arpno f.arpno@uncas.t Introducton Why we use models and
More informationChapter 3 Describing Data Using Numerical Measures
Chapter 3 Student Lecture Notes 3-1 Chapter 3 Descrbng Data Usng Numercal Measures Fall 2006 Fundamentals of Busness Statstcs 1 Chapter Goals To establsh the usefulness of summary measures of data. The
More informationLecture 5 Decoding Binary BCH Codes
Lecture 5 Decodng Bnary BCH Codes In ths class, we wll ntroduce dfferent methods for decodng BCH codes 51 Decodng the [15, 7, 5] 2 -BCH Code Consder the [15, 7, 5] 2 -code C we ntroduced n the last lecture
More informationComputing Correlated Equilibria in Multi-Player Games
Computng Correlated Equlbra n Mult-Player Games Chrstos H. Papadmtrou Presented by Zhanxang Huang December 7th, 2005 1 The Author Dr. Chrstos H. Papadmtrou CS professor at UC Berkley (taught at Harvard,
More informationprinceton univ. F 13 cos 521: Advanced Algorithm Design Lecture 3: Large deviations bounds and applications Lecturer: Sanjeev Arora
prnceton unv. F 13 cos 521: Advanced Algorthm Desgn Lecture 3: Large devatons bounds and applcatons Lecturer: Sanjeev Arora Scrbe: Today s topc s devaton bounds: what s the probablty that a random varable
More informationfind (x): given element x, return the canonical element of the set containing x;
COS 43 Sprng, 009 Dsjont Set Unon Problem: Mantan a collecton of dsjont sets. Two operatons: fnd the set contanng a gven element; unte two sets nto one (destructvely). Approach: Canoncal element method:
More informationFor now, let us focus on a specific model of neurons. These are simplified from reality but can achieve remarkable results.
Neural Networks : Dervaton compled by Alvn Wan from Professor Jtendra Malk s lecture Ths type of computaton s called deep learnng and s the most popular method for many problems, such as computer vson
More informationMessage modification, neutral bits and boomerangs
Message modfcaton, neutral bts and boomerangs From whch round should we start countng n SHA? Antone Joux DGA and Unversty of Versalles St-Quentn-en-Yvelnes France Jont work wth Thomas Peyrn 1 Dfferental
More informationLecture 10: May 6, 2013
TTIC/CMSC 31150 Mathematcal Toolkt Sprng 013 Madhur Tulsan Lecture 10: May 6, 013 Scrbe: Wenje Luo In today s lecture, we manly talked about random walk on graphs and ntroduce the concept of graph expander,
More information18.1 Introduction and Recap
CS787: Advanced Algorthms Scrbe: Pryananda Shenoy and Shjn Kong Lecturer: Shuch Chawla Topc: Streamng Algorthmscontnued) Date: 0/26/2007 We contnue talng about streamng algorthms n ths lecture, ncludng
More informationSpeeding up Computation of Scalar Multiplication in Elliptic Curve Cryptosystem
H.K. Pathak et. al. / (IJCSE) Internatonal Journal on Computer Scence and Engneerng Speedng up Computaton of Scalar Multplcaton n Ellptc Curve Cryptosystem H. K. Pathak Manju Sangh S.o.S n Computer scence
More information2.3 Nilpotent endomorphisms
s a block dagonal matrx, wth A Mat dm U (C) In fact, we can assume that B = B 1 B k, wth B an ordered bass of U, and that A = [f U ] B, where f U : U U s the restrcton of f to U 40 23 Nlpotent endomorphsms
More informationACTM State Calculus Competition Saturday April 30, 2011
ACTM State Calculus Competton Saturday Aprl 30, 2011 ACTM State Calculus Competton Sprng 2011 Page 1 Instructons: For questons 1 through 25, mark the best answer choce on the answer sheet provde Afterward
More informationCS 331 DESIGN AND ANALYSIS OF ALGORITHMS DYNAMIC PROGRAMMING. Dr. Daisy Tang
CS DESIGN ND NLYSIS OF LGORITHMS DYNMIC PROGRMMING Dr. Dasy Tang Dynamc Programmng Idea: Problems can be dvded nto stages Soluton s a sequence o decsons and the decson at the current stage s based on the
More informationVapnik-Chervonenkis theory
Vapnk-Chervonenks theory Rs Kondor June 13, 2008 For the purposes of ths lecture, we restrct ourselves to the bnary supervsed batch learnng settng. We assume that we have an nput space X, and an unknown
More informationFoundations of Arithmetic
Foundatons of Arthmetc Notaton We shall denote the sum and product of numbers n the usual notaton as a 2 + a 2 + a 3 + + a = a, a 1 a 2 a 3 a = a The notaton a b means a dvdes b,.e. ac = b where c s an
More informationLecture 14: Nov. 11 & 13
CIS 2168 Data Structures Fall 2014 Lecturer: Anwar Mamat Lecture 14: Nov. 11 & 13 Disclaimer: These notes may be distributed outside this class only with the permission of the Instructor. 14.1 Sorting
More informationChapter Newton s Method
Chapter 9. Newton s Method After readng ths chapter, you should be able to:. Understand how Newton s method s dfferent from the Golden Secton Search method. Understand how Newton s method works 3. Solve
More informationCase A. P k = Ni ( 2L i k 1 ) + (# big cells) 10d 2 P k.
THE CELLULAR METHOD In ths lecture, we ntroduce the cellular method as an approach to ncdence geometry theorems lke the Szemeréd-Trotter theorem. The method was ntroduced n the paper Combnatoral complexty
More informationSingle Variable Optimization
8/4/07 Course Instructor Dr. Raymond C. Rump Oce: A 337 Phone: (95) 747 6958 E Mal: rcrump@utep.edu Topc 8b Sngle Varable Optmzaton EE 4386/530 Computatonal Methods n EE Outlne Mathematcal Prelmnares Sngle
More informationFeature Selection: Part 1
CSE 546: Machne Learnng Lecture 5 Feature Selecton: Part 1 Instructor: Sham Kakade 1 Regresson n the hgh dmensonal settng How do we learn when the number of features d s greater than the sample sze n?
More informationSection 8.3 Polar Form of Complex Numbers
80 Chapter 8 Secton 8 Polar Form of Complex Numbers From prevous classes, you may have encountered magnary numbers the square roots of negatve numbers and, more generally, complex numbers whch are the
More informationEEE 241: Linear Systems
EEE : Lnear Systems Summary #: Backpropagaton BACKPROPAGATION The perceptron rule as well as the Wdrow Hoff learnng were desgned to tran sngle layer networks. They suffer from the same dsadvantage: they
More informationKernel Methods and SVMs Extension
Kernel Methods and SVMs Extenson The purpose of ths document s to revew materal covered n Machne Learnng 1 Supervsed Learnng regardng support vector machnes (SVMs). Ths document also provdes a general
More informationAppendix B. The Finite Difference Scheme
140 APPENDIXES Appendx B. The Fnte Dfference Scheme In ths appendx we present numercal technques whch are used to approxmate solutons of system 3.1 3.3. A comprehensve treatment of theoretcal and mplementaton
More informationCHAPTER IV RESEARCH FINDING AND ANALYSIS
CHAPTER IV REEARCH FINDING AND ANALYI A. Descrpton of Research Fndngs To fnd out the dfference between the students who were taught by usng Mme Game and the students who were not taught by usng Mme Game
More informationLOW BIAS INTEGRATED PATH ESTIMATORS. James M. Calvin
Proceedngs of the 007 Wnter Smulaton Conference S G Henderson, B Bller, M-H Hseh, J Shortle, J D Tew, and R R Barton, eds LOW BIAS INTEGRATED PATH ESTIMATORS James M Calvn Department of Computer Scence
More informationIntroduction to Algorithms
Introducton to Algorthms 6.046J/18.401J Lecture 7 Prof. Potr Indyk Data Structures Role of data structures: Encapsulate data Support certan operatons (e.g., INSERT, DELETE, SEARCH) What data structures
More informationProblem Set 9 Solutions
Desgn and Analyss of Algorthms May 4, 2015 Massachusetts Insttute of Technology 6.046J/18.410J Profs. Erk Demane, Srn Devadas, and Nancy Lynch Problem Set 9 Solutons Problem Set 9 Solutons Ths problem
More informationCHAPTER IV RESEARCH FINDING AND DISCUSSIONS
CHAPTER IV RESEARCH FINDING AND DISCUSSIONS A. Descrpton of Research Fndng. The Implementaton of Learnng Havng ganed the whole needed data, the researcher then dd analyss whch refers to the statstcal data
More informationSome Consequences. Example of Extended Euclidean Algorithm. The Fundamental Theorem of Arithmetic, II. Characterizing the GCD and LCM
Example of Extended Eucldean Algorthm Recall that gcd(84, 33) = gcd(33, 18) = gcd(18, 15) = gcd(15, 3) = gcd(3, 0) = 3 We work backwards to wrte 3 as a lnear combnaton of 84 and 33: 3 = 18 15 [Now 3 s
More informationEEL 6266 Power System Operation and Control. Chapter 3 Economic Dispatch Using Dynamic Programming
EEL 6266 Power System Operaton and Control Chapter 3 Economc Dspatch Usng Dynamc Programmng Pecewse Lnear Cost Functons Common practce many utltes prefer to represent ther generator cost functons as sngle-
More informationE Tail Inequalities. E.1 Markov s Inequality. Non-Lecture E: Tail Inequalities
Algorthms Non-Lecture E: Tal Inequaltes If you hold a cat by the tal you learn thngs you cannot learn any other way. Mar Twan E Tal Inequaltes The smple recursve structure of sp lsts made t relatvely easy
More informationA PROBABILITY-DRIVEN SEARCH ALGORITHM FOR SOLVING MULTI-OBJECTIVE OPTIMIZATION PROBLEMS
HCMC Unversty of Pedagogy Thong Nguyen Huu et al. A PROBABILITY-DRIVEN SEARCH ALGORITHM FOR SOLVING MULTI-OBJECTIVE OPTIMIZATION PROBLEMS Thong Nguyen Huu and Hao Tran Van Department of mathematcs-nformaton,
More informationCSE4210 Architecture and Hardware for DSP
4210 Archtecture and Hardware for DSP Lecture 1 Introducton & Number systems Admnstratve Stuff 4210 Archtecture and Hardware for DSP Text: VLSI Dgtal Sgnal Processng Systems: Desgn and Implementaton. K.
More informationSupplement: Proofs and Technical Details for The Solution Path of the Generalized Lasso
Supplement: Proofs and Techncal Detals for The Soluton Path of the Generalzed Lasso Ryan J. Tbshran Jonathan Taylor In ths document we gve supplementary detals to the paper The Soluton Path of the Generalzed
More informationTornado and Luby Transform Codes. Ashish Khisti Presentation October 22, 2003
Tornado and Luby Transform Codes Ashsh Khst 6.454 Presentaton October 22, 2003 Background: Erasure Channel Elas[956] studed the Erasure Channel β x x β β x 2 m x 2 k? Capacty of Noseless Erasure Channel
More informationGeneralized Linear Methods
Generalzed Lnear Methods 1 Introducton In the Ensemble Methods the general dea s that usng a combnaton of several weak learner one could make a better learner. More formally, assume that we have a set
More informationLectures - Week 4 Matrix norms, Conditioning, Vector Spaces, Linear Independence, Spanning sets and Basis, Null space and Range of a Matrix
Lectures - Week 4 Matrx norms, Condtonng, Vector Spaces, Lnear Independence, Spannng sets and Bass, Null space and Range of a Matrx Matrx Norms Now we turn to assocatng a number to each matrx. We could
More informationFinding Primitive Roots Pseudo-Deterministically
Electronc Colloquum on Computatonal Complexty, Report No 207 (205) Fndng Prmtve Roots Pseudo-Determnstcally Ofer Grossman December 22, 205 Abstract Pseudo-determnstc algorthms are randomzed search algorthms
More informationA Framework for Aperiodic Model Predictive Control
A Framewor for Aperodc Model Predctve Control Alna Eqtam 1, Dmos V. Dmarogonas 2 and Kostas J. Kyraopoulos 1 1 Control Systems Lab, NaBonal Tech. Unv. of Athens (NTUA) 2 School of El. Eng., Royal InsBtute
More informationLecture 14: Bandits with Budget Constraints
IEOR 8100-001: Learnng and Optmzaton for Sequental Decson Makng 03/07/16 Lecture 14: andts wth udget Constrants Instructor: Shpra Agrawal Scrbed by: Zhpeng Lu 1 Problem defnton In the regular Mult-armed
More informationDifference Equations
Dfference Equatons c Jan Vrbk 1 Bascs Suppose a sequence of numbers, say a 0,a 1,a,a 3,... s defned by a certan general relatonshp between, say, three consecutve values of the sequence, e.g. a + +3a +1
More informationENTROPIC QUESTIONING
ENTROPIC QUESTIONING NACHUM. Introucton Goal. Pck the queston that contrbutes most to fnng a sutable prouct. Iea. Use an nformaton-theoretc measure. Bascs. Entropy (a non-negatve real number) measures
More informationNeural networks. Nuno Vasconcelos ECE Department, UCSD
Neural networs Nuno Vasconcelos ECE Department, UCSD Classfcaton a classfcaton problem has two types of varables e.g. X - vector of observatons (features) n the world Y - state (class) of the world x X
More informationSTAT 309: MATHEMATICAL COMPUTATIONS I FALL 2018 LECTURE 16
STAT 39: MATHEMATICAL COMPUTATIONS I FALL 218 LECTURE 16 1 why teratve methods f we have a lnear system Ax = b where A s very, very large but s ether sparse or structured (eg, banded, Toepltz, banded plus
More informationReview of Taylor Series. Read Section 1.2
Revew of Taylor Seres Read Secton 1.2 1 Power Seres A power seres about c s an nfnte seres of the form k = 0 k a ( x c) = a + a ( x c) + a ( x c) + a ( x c) k 2 3 0 1 2 3 + In many cases, c = 0, and the
More informationGrover s Algorithm + Quantum Zeno Effect + Vaidman
Grover s Algorthm + Quantum Zeno Effect + Vadman CS 294-2 Bomb 10/12/04 Fall 2004 Lecture 11 Grover s algorthm Recall that Grover s algorthm for searchng over a space of sze wors as follows: consder the
More informationIntroduction to Information Theory, Data Compression,
Introducton to Informaton Theory, Data Compresson, Codng Mehd Ibm Brahm, Laura Mnkova Aprl 5, 208 Ths s the augmented transcrpt of a lecture gven by Luc Devroye on the 3th of March 208 for a Data Structures
More informationCHAPTER 5 NUMERICAL EVALUATION OF DYNAMIC RESPONSE
CHAPTER 5 NUMERICAL EVALUATION OF DYNAMIC RESPONSE Analytcal soluton s usually not possble when exctaton vares arbtrarly wth tme or f the system s nonlnear. Such problems can be solved by numercal tmesteppng
More informationEnsemble Methods: Boosting
Ensemble Methods: Boostng Ncholas Ruozz Unversty of Texas at Dallas Based on the sldes of Vbhav Gogate and Rob Schapre Last Tme Varance reducton va baggng Generate new tranng data sets by samplng wth replacement
More informationCSci 6974 and ECSE 6966 Math. Tech. for Vision, Graphics and Robotics Lecture 21, April 17, 2006 Estimating A Plane Homography
CSc 6974 and ECSE 6966 Math. Tech. for Vson, Graphcs and Robotcs Lecture 21, Aprl 17, 2006 Estmatng A Plane Homography Overvew We contnue wth a dscusson of the major ssues, usng estmaton of plane projectve
More informationAttacks on RSA The Rabin Cryptosystem Semantic Security of RSA Cryptology, Tuesday, February 27th, 2007 Nils Andersen. Complexity Theoretic Reduction
Attacks on RSA The Rabn Cryptosystem Semantc Securty of RSA Cryptology, Tuesday, February 27th, 2007 Nls Andersen Square Roots modulo n Complexty Theoretc Reducton Factorng Algorthms Pollard s p 1 Pollard
More informationFE REVIEW OPERATIONAL AMPLIFIERS (OP-AMPS)( ) 8/25/2010
FE REVEW OPERATONAL AMPLFERS (OP-AMPS)( ) 1 The Op-amp 2 An op-amp has two nputs and one output. Note the op-amp below. The termnal labeled l wth the (-) sgn s the nvertng nput and the nput labeled wth
More informationA New Design of Multiplier using Modified Booth Algorithm and Reversible Gate Logic
Internatonal Journal of Computer Applcatons Technology and Research A New Desgn of Multpler usng Modfed Booth Algorthm and Reversble Gate Logc K.Nagarjun Department of ECE Vardhaman College of Engneerng,
More informationExample: (13320, 22140) =? Solution #1: The divisors of are 1, 2, 3, 4, 5, 6, 9, 10, 12, 15, 18, 20, 27, 30, 36, 41,
The greatest common dvsor of two ntegers a and b (not both zero) s the largest nteger whch s a common factor of both a and b. We denote ths number by gcd(a, b), or smply (a, b) when there s no confuson
More information= z 20 z n. (k 20) + 4 z k = 4
Problem Set #7 solutons 7.2.. (a Fnd the coeffcent of z k n (z + z 5 + z 6 + z 7 + 5, k 20. We use the known seres expanson ( n+l ( z l l z n below: (z + z 5 + z 6 + z 7 + 5 (z 5 ( + z + z 2 + z + 5 5
More informationGeneral theory of fuzzy connectedness segmentations: reconciliation of two tracks of FC theory
General theory of fuzzy connectedness segmentatons: reconclaton of two tracks of FC theory Krzysztof Chrs Ceselsk Department of Mathematcs, West Vrgna Unversty and MIPG, Department of Radology, Unversty
More informationHomotopy Type Theory Lecture Notes
15-819 Homotopy Type Theory Lecture Notes Evan Cavallo and Stefan Muller November 18 and 20, 2013 1 Reconsder Nat n smple types s a warmup to dscussng nductve types, we frst revew several equvalent presentatons
More informationChapter 6. Supplemental Text Material
Chapter 6. Supplemental Text Materal S6-. actor Effect Estmates are Least Squares Estmates We have gven heurstc or ntutve explanatons of how the estmates of the factor effects are obtaned n the textboo.
More informationFinding the Longest Similar Subsequence of Thumbprints for Intrusion Detection
Fndng the Longest Smlar Subsequence of Thumbprnts for Intruson Detecton Mng D. Wan, Shou-Hsuan Stephen Huang, and Janhua Yang Department of Computer Scence, Unversty of Houston Houston, Texas, 77204, USA
More informationStanford University CS359G: Graph Partitioning and Expanders Handout 4 Luca Trevisan January 13, 2011
Stanford Unversty CS359G: Graph Parttonng and Expanders Handout 4 Luca Trevsan January 3, 0 Lecture 4 In whch we prove the dffcult drecton of Cheeger s nequalty. As n the past lectures, consder an undrected
More informationLecture Space-Bounded Derandomization
Notes on Complexty Theory Last updated: October, 2008 Jonathan Katz Lecture Space-Bounded Derandomzaton 1 Space-Bounded Derandomzaton We now dscuss derandomzaton of space-bounded algorthms. Here non-trval
More informationDefinition. Measures of Dispersion. Measures of Dispersion. Definition. The Range. Measures of Dispersion 3/24/2014
Measures of Dsperson Defenton Range Interquartle Range Varance and Standard Devaton Defnton Measures of dsperson are descrptve statstcs that descrbe how smlar a set of scores are to each other The more
More informationFeb 14: Spatial analysis of data fields
Feb 4: Spatal analyss of data felds Mappng rregularly sampled data onto a regular grd Many analyss technques for geophyscal data requre the data be located at regular ntervals n space and/or tme. hs s
More informationBasic Regular Expressions. Introduction. Introduction to Computability. Theory. Motivation. Lecture4: Regular Expressions
Introducton to Computablty Theory Lecture: egular Expressons Prof Amos Israel Motvaton If one wants to descrbe a regular language, La, she can use the a DFA, Dor an NFA N, such L ( D = La that that Ths
More informationHongyi Miao, College of Science, Nanjing Forestry University, Nanjing ,China. (Received 20 June 2013, accepted 11 March 2014) I)ϕ (k)
ISSN 1749-3889 (prnt), 1749-3897 (onlne) Internatonal Journal of Nonlnear Scence Vol.17(2014) No.2,pp.188-192 Modfed Block Jacob-Davdson Method for Solvng Large Sparse Egenproblems Hongy Mao, College of
More information