DATA STRUCTURES. amortized analysis binomial heaps Fibonacci heaps union-find. Data structures. Appetizer. Appetizer

Size: px
Start display at page:

Download "DATA STRUCTURES. amortized analysis binomial heaps Fibonacci heaps union-find. Data structures. Appetizer. Appetizer"

Transcription

1 Data structures DATA STRUCTURES Static problems. Give a iput, produce a output. Ex. Sortig, FFT, edit distace, shortest paths, MST, max-flow,... amortized aalysis biomial heaps Fiboacci heaps uio-fid Dyamic problems. Give a sequece of operatios (give oe at a time), produce a sequece of outputs. Ex. Stack, queue, priority queue, symbol table, uio-fid,. Algorithm. Step-by-step procedure to solve a problem. Data structure. Way to store ad orgaize data. Ex. Array, liked list, biary heap, biary search tree, hash table, Lecture slides by Kevi Waye Last updated o Apr 8, 0 6: AM Appetizer Appetizer Goal. Desig a data structure to support all operatios i O() time. INIT(): create ad retur a iitialized array (all zero) of legth. READ(A, i): retur i th elemet of array. WRITE(A, i, value): set i th elemet of array to value. Assumptios. true i C or C++, but ot Java Ca MALLOC a uiitialized array of legth i O() time. Give a array, ca read or write i th elemet i O() time. Data structure. Three arrays A[.. ], B[.. ], ad C[.. ], ad a iteger k. A[i] stores the curret value for READ (if iitialized). k = umber of iitialized etries. C[j] = idex of j th iitialized etry for j =,, k. If C[j] = i, the B[i] = j for j =,, k. Theorem. A[i] is iitialized iff both B[i] k ad C[B[i]] = i. Pf. Ahead. Remark. A array does INIT i O() time ad READ ad WRITE i O() time. A[ ] 5 6 8? 55 99??? B[ ]???? C[ ] 6???? k = A[]=99, A[6]=, A[]=, ad A[]=55 iitialized i that order

2 Appetizer Appetizer Theorem. A[i] is iitialized iff both B[i] k ad C[B[i]] = i. Pf. INIT (A, ) k 0. A MALLOC(). READ (A, i) IF (INITIALIZED (A[i])) RETURN A[i]. WRITE (A, i, value) IF (INITIALIZED (A[i])) A[i] value. Suppose A[i] is the j th etry to be iitialized. The C[j] = i ad B[i] = j. Thus, C[B[i]] = i. B MALLOC(). ELSE ELSE C MALLOC(). RETURN 0. k k +. s MALLOC(). A[i] value B[i] k. A[ ]? 55 99??? INITIALIZED (A, i) C[k] i. IF ( B[i] k) ad (C[B[i]] = i) B[ ]???? RETURN true. ELSE C[ ] 6???? RETURN false. k = 5 A[]=99, A[6]=, A[]=, ad A[]=55 iitialized i that order 6 Appetizer Theorem. A[i] is iitialized iff both B[i] k ad C[B[i]] = i. Pf. Suppose A[i] is uiitialized. If B[i] < or B[i] > k, the A[i] clearly uiitialized. If B[i] k by coicidece, the we still ca't have C[B[i]] = i because oe of the etries C[.. k] ca equal i. AMORTIZED ANALYSIS biary couter multipop stack dyamic table A[ ]? 55 99??? B[ ]???? Lecture slides by Kevi Waye C[ ] 6???? k = A[]=99, A[6]=, A[]=, ad A[]=55 iitialized i that order Last updated o Apr 8, 0 6: AM

3 Amortized aalysis Worst-case aalysis. Determie worst-case ruig time of a data structure operatio as fuctio of the iput size. Amortized aalysis. Determie worst-case ruig time of a sequece of data structure operatios as a fuctio of the iput size. ca be too pessimistic if the oly way to ecouter a expesive operatio is if there were lots of previous cheap operatios Ex. Startig from a empty stack implemeted with a dyamic table, ay sequece of push ad pop operatios takes O() time i the worst case. Amortized aalysis: applicatios Splay trees. Dyamic table. Fiboacci heaps. Garbage collectio. Move-to-frot list updatig. Push-relabel algorithm for max flow. Path compressio for disjoit-set uio. Structural modificatios to red-black trees. Security, databases, distributed computig,... SIAM J. ALG. DISC. METH. Vol. 6, No., April Society for Idustrial ad Applied Mathematics 06 AMORTIZED COMPUTATIONAL COMPLEXITY* ROBERT ENDRE TARJANt Abstract. A powerful techique i the complexity aalysis of data structures is amortizatio, or averagig over time. Amortized ruig time is a realistic but robust complexity measure for which we ca obtai surprisigly tight upper ad lower bouds o a variety of algorithms. By followig the priciple of desigig algorithms whose amortized complexity is low, we obtai "self-adjustig" data structures that are simple, flexible ad efficiet. This paper surveys recet work by several researchers o amortized complexity. ASM(MOS) subject classificatios. 68C5, 68E Biary couter AMORTIZED ANALYSIS Goal. Icremet a k-bit biary couter (mod k ). Represetatio. aj = j th least sigificat bit of couter. CHAPTER biary couter multipop stack dyamic table Couter value A[] A[6] A[5] A[] A[] A[] A[] A[0] Cost model. Number of bits flipped.

4 Biary couter Aggregate method (brute force) Goal. Icremet a k-bit biary couter (mod k ). Represetatio. a j = j th least sigificat bit of couter. Aggregate method. Sum up sequece of operatios, weighted by their cost. Couter value A[] A[6] A[5] A[] A[] A[] A[] A[0] Couter value A[] A[6] A[5] A[] A[] A[] A[] A[0] Total cost Theorem. Startig from the zero couter, a sequece of INCREMENT operatios flips O( k) bits. Pf. At most k bits flipped per icremet. Biary couter: aggregate method Accoutig method (baker's method) Startig from the zero couter, i a sequece of INCREMENT operatios: Bit 0 flips times. Bit flips / times. Bit flips / times. Theorem. Startig from the zero couter, a sequece of INCREMENT operatios flips O() bits. Pf. Bit j flips / j times. The total umber of bits flipped is k j=0 j < j=0 j Assig differet charges to each operatio. Di = data structure after operatio i. c i = actual cost of operatio i. ĉi = amortized cost of operatio i = amout we charge operatio i. Whe ĉi > ci, we store credits i data structure Di to pay for future ops. Iitial data structure D0 starts with zero credits. Key ivariat. The total umber of credits i the data structure 0. i= ĉ i i= c i 0 ca be more or less tha actual cost = Remark. Theorem may be false if iitial couter is ot zero. 5 6

5 Accoutig method (baker's method) Biary couter: accoutig method Assig differet charges to each operatio. D i = data structure after operatio i. c i = actual cost of operatio i. ĉ i = amortized cost of operatio i = amout we charge operatio i. Whe ĉi > ci, we store credits i data structure Di to pay for future ops. Iitial data structure D0 starts with zero credits. ca be more or less tha actual cost Credits. Oe credit pays for a bit flip. Ivariat. Each bit that is set to has oe credit. Accoutig. Flip bit j from 0 to : charge two credits (use oe ad save oe i bit j). Key ivariat. The total umber of credits i the data structure 0. c i 0 i= ĉ i i= Theorem. Startig from the iitial data structure D 0, the total actual cost of ay sequece of operatios is at most the sum of the amortized costs. Pf. The amortized cost of the sequece of operatios is: ĉ i c i. i= i= Ituitio. Measure ruig time i terms of credits (time = moey). icremet Biary couter: accoutig method Biary couter: accoutig method Credits. Oe credit pays for a bit flip. Ivariat. Each bit that is set to has oe credit. Credits. Oe credit pays for a bit flip. Ivariat. Each bit that is set to has oe credit. Accoutig. Flip bit j from 0 to : charge two credits (use oe ad save oe i bit j). Flip bit j from to 0: pay for it with saved credit i bit j. Accoutig. Flip bit j from 0 to : charge two credits (use oe ad save oe i bit j). Flip bit j from to 0: pay for it with saved credit i bit j. icremet

6 Biary couter: accoutig method Potetial method (physicist's method) Credits. Oe credit pays for a bit flip. Ivariat. Each bit that is set to has oe credit. Accoutig. Flip bit j from 0 to : charge two credits (use oe ad save oe i bit j). Flip bit j from to 0: pay for it with saved credit i bit j. Potetial fuctio. Φ(D i) maps each data structure D i to a real umber s.t.: Φ(D 0) = 0. Φ(D i) 0 for each data structure D i. Actual ad amortized costs. ci = actual cost of i th operatio. ĉ i = c i + Φ(D i) Φ(D i ) = amortized cost of i th operatio. Theorem. Startig from the zero couter, a sequece of INCREMENT operatios flips O() bits. Pf. The algorithm maitais the ivariat that ay bit that is curretly set to has oe credit umber of credits i each bit 0. Potetial method (physicist's method) Biary couter: potetial method Potetial fuctio. Φ(Di) maps each data structure Di to a real umber s.t.: Φ(D0) = 0. Φ(D i) 0 for each data structure D i. Potetial fuctio. Let Φ(D) = umber of bits i the biary couter D. Φ(D0) = 0. Φ(D i) 0 for each D i. Actual ad amortized costs. ci = actual cost of i th operatio. ĉ i = c i + Φ(D i) Φ(D i ) = amortized cost of i th operatio. Theorem. Startig from the iitial data structure D0, the total actual cost of ay sequece of operatios is at most the sum of the amortized costs. Pf. The amortized cost of the sequece of operatios is: icremet i= ĉ i = = i= (c i + (D i ) (D i ) c i + (D ) (D 0 ) i= c i i=

7 Biary couter: potetial method Biary couter: potetial method Potetial fuctio. Let Φ(D) = umber of bits i the biary couter D. Φ(D 0) = 0. Φ(D i) 0 for each D i. Potetial fuctio. Let Φ(D) = umber of bits i the biary couter D. Φ(D 0) = 0. Φ(D i) 0 for each D i. icremet Biary couter: potetial method Famous potetial fuctios Potetial fuctio. Let Φ(D) = umber of bits i the biary couter D. Φ(D0) = 0. Φ(D i) 0 for each D i. Fiboacci heaps. Φ(H) = trees(h) + marks(h). Splay trees. (T ) = log size(x) x T Theorem. Startig from the zero couter, a sequece of INCREMENT operatios flips O() bits. Pf. Suppose that the i th icremet operatio flips ti bits from to 0. The actual cost c i t i +. The amortized cost ĉi = ci + Φ(Di) Φ(Di ) ci + ti. operatio sets oe bit to (uless couter resets to zero) Move-to-frot. Φ(L) = iversios(l, L*). Preflow-push. (f) = Red-black trees. (T ) = w(x) = v : excess(v) > 0 x T w(x) height(v) 0 x x 0 x x 8

8 Multipop stack AMORTIZED ANALYSIS biary couter multipop stack dyamic table Goal. Support operatios o a set of elemets: PUSH(S, x): push object x oto stack S. POP(S): remove ad retur the most-recetly added object. MULTIPOP(S, k): remove the most-recetly added k objects. MULTIPOP (S, k) FOR i = TO k POP (S). SECTION. Exceptios. We assume POP throws a exceptio if stack is empty. 0 Multipop stack Multipop stack: aggregate method Goal. Support operatios o a set of elemets: PUSH(S, x): push object x oto stack S. POP(S): remove ad retur the most-recetly added object. MULTIPOP(S, k): remove the most-recetly added k objects. Goal. Support operatios o a set of elemets: PUSH(S, x): push object x oto stack S. POP(S): remove ad retur the most-recetly added object. MULTIPOP(S, k): remove the most-recetly added k objects. Theorem. Startig from a empty stack, ay itermixed sequece of PUSH, POP, ad MULTIPOP operatios takes O( ) time. Pf. Use a sigly-liked list. PoP ad PUSH take O() time each. MULTIPOP takes O() time. overly pessimistic upper boud Theorem. Startig from a empty stack, ay itermixed sequece of PUSH, POP, ad MULTIPOP operatios takes O() time. Pf. A object is popped at most oce for each time it is pushed oto stack. There are PUSH operatios. Thus, there are POP operatios (icludig those made withi MULTIPOP). top

9 Multipop stack: accoutig method Multipop stack: potetial method Credits. Oe credit pays for a push or pop. Accoutig. PUSH(S, x): charge two credits. use oe credit to pay for pushig x ow store oe credit to pay for poppig x at some poit i the future No other operatio is charged a credit. Theorem. Startig from a empty stack, ay itermixed sequece of PUSH, POP, ad MULTIPOP operatios takes O() time. Potetial fuctio. Let Φ(D) = umber of objects curretly o the stack. Φ(D 0) = 0. Φ(D i) 0 for each D i. Theorem. Startig from a empty stack, ay itermixed sequece of PUSH, POP, ad MULTIPOP operatios takes O() time. Pf. [Case : push] Suppose that the i th operatio is a PUSH. The actual cost c i =. The amortized cost ĉ i = c i + Φ(D i) Φ(D i ) = + =. Pf. The algorithm maitais the ivariat that every object remaiig o the stack has credit umber of credits i data structure 0. Multipop stack: potetial method Multipop stack: potetial method Potetial fuctio. Let Φ(D) = umber of objects curretly o the stack. Φ(D0) = 0. Φ(D i) 0 for each D i. Potetial fuctio. Let Φ(D) = umber of objects curretly o the stack. Φ(D0) = 0. Φ(D i) 0 for each D i. Theorem. Startig from a empty stack, ay itermixed sequece of PUSH, POP, ad MULTIPOP operatios takes O() time. Theorem. Startig from a empty stack, ay itermixed sequece of PUSH, POP, ad MULTIPOP operatios takes O() time. Pf. [Case : pop] Suppose that the i th operatio is a POP. The actual cost c i =. The amortized cost ĉi = ci + Φ(Di) Φ(Di ) = = 0. Pf. [Case : multipop] Suppose that the i th operatio is a MULTIPOP of k objects. The actual cost c i = k. The amortized cost ĉi = ci + Φ(Di) Φ(Di ) = k k =

10 Dyamic table AMORTIZED ANALYSIS biary couter multipop stack dyamic table Goal. Store items i a table (e.g., for hash table, biary heap). Two operatios: INSERT ad DELETE. too may items iserted expad table. too may items deleted cotract table. Requiremet: if table cotais m items, the space = Θ(m). Theorem. Startig from a empty dyamic table, ay itermixed sequece of INSERT ad DELETE operatios takes O( ) time. Pf. A sigle INSERT or DELETE takes O() time. overly pessimistic upper boud SECTION. 8 Dyamic table: isert oly Iitialize table to be size. INSERT: if table is full, first copy all items to a table of twice the size. isert old size ew size cost Dyamic table: isert oly Theorem. [via aggregate method] Startig from a empty dyamic table, ay sequece of INSERT operatios takes O() time. Pf. Let ci deote the cost of the i th isertio. c i = i i Startig from empty table, the cost of a sequece of INSERT operatios is: lg c i + j i= j=0 < + = Cost model. Number of items that are copied. 9 0

11 Dyamic table: isert oly Dyamic table: isert oly Accoutig. INSERT: charge credits (use credit to isert; save with ew item) Theorem. [via accoutig method] Startig from a empty dyamic table, ay sequece of INSERT operatios takes O() time. Pf. The algorithm maitais the ivariat that there are credits with each item i right half of table. Whe table doubles, oe-half of the items i the table have credits. This pays for the work eeded to double the table Dyamic table: isert oly Dyamic table: isert oly Theorem. [via potetial method] Startig from a empty dyamic table, ay sequece of INSERT operatios takes O() time. Theorem. [via potetial method] Startig from a empty dyamic table, ay sequece of INSERT operatios takes O() time. Pf. Let Φ(Di) = size(di) capacity(di). Pf. Let Φ(Di) = size(di) capacity(di). umber of elemets capacity of array umber of elemets capacity of array 5 6 Case. [does ot trigger expasio] size(d i) capacity(d i ). Actual cost ci =. Φ(D i) Φ(D i ) =. Amortized costs ĉi = ci + Φ(Di) Φ(Di ) = + =. Case. [triggers expasio] size(di) = + capacity(di ). Actual cost ci = + capacity(di ). Φ(D i) Φ(D i ) = capacity(d i) + capacity(d i ) = capacity(d i ). Amortized costs ĉi = ci + Φ(Di) Φ(Di ) = + =.

12 Dyamic table: doublig ad halvig Dyamic table: isert ad delete Thrashig. Iitialize table to be of fixed size, say. INSERT: if table is full, expad to a table of twice the size. DELETE: if table is ½-full, cotract to a table of half the size. Efficiet solutio. Iitialize table to be of fixed size, say. INSERT: if table is full, expad to a table of twice the size. DELETE: if table is ¼-full, cotract to a table of half the size. Memory usage. A dyamic table uses O() memory to store items. Pf. Table is always at least ¼-full (provided it is ot empty). Theorem. [via aggregate method] Startig from a empty dyamic table, ay itermixed sequece of INSERT ad DELETE operatios takes O() time. Pf. I betwee resizig evets, each INSERT ad DELETE takes O() time. Cosider total amout of work betwee two resizig evets. Just after the table is doubled to size m, it cotais m / items. Just after the table is halved to size m, it cotais m / items. Just before the ext resizig, it cotais either m / or m items. After resizig to m, we must perform Ω(m) operatios before we resize agai (either m isertios or m / deletios). Resizig a table of size m requires O(m) time. 5 6 Dyamic table: isert ad delete Dyamic table: isert ad delete isert Accoutig. INSERT: charge credits ( credit for isert; save with ew item). DELETE: charge credits ( credit to delete, save i emptied slot). discard ay existig credits delete Theorem. [via accoutig method] Startig from a empty dyamic table, ay itermixed sequece of INSERT ad DELETE operatios takes O() time Pf. The algorithm maitais the ivariat that there are credits with each resize ad delete item i the right half of table; credit with each empty slot i the left half. Whe table doubles, each item i right half of table has credits. Whe table halves, each empty slot i left half of table has credit. 8

13 Dyamic table: isert ad delete Theorem. [via potetial method] Startig from a empty dyamic table, ay itermixed sequece of INSERT ad DELETE operatios takes O() time. Pf sketch. Let α(di) = size(di) / capacity(di). (D i )= size(d i) capacity(d i ) / capacity(d i) size(d i ) < / Whe α(d) = /, Φ(D) = 0. Whe α(d) =, Φ(D) = size(d i). Whe α(d) = /, Φ(D) = size(d i).... [zero potetial after resizig] [ca pay for expasio] [ca pay for cotractio] 9

DATA STRUCTURES. amortized analysis binomial heaps Fibonacci heaps union-find. Lecture slides by Kevin Wayne. Last updated on Apr 8, :13 AM

DATA STRUCTURES. amortized analysis binomial heaps Fibonacci heaps union-find. Lecture slides by Kevin Wayne. Last updated on Apr 8, :13 AM DATA STRUCTURES amortized analysis binomial heaps Fibonacci heaps union-find Lecture slides by Kevin Wayne http://www.cs.princeton.edu/~wayne/kleinberg-tardos Last updated on Apr 8, 2013 6:13 AM Data structures

More information

CIS 121 Data Structures and Algorithms with Java Spring Stacks and Queues Monday, February 12 / Tuesday, February 13

CIS 121 Data Structures and Algorithms with Java Spring Stacks and Queues Monday, February 12 / Tuesday, February 13 CIS Data Structures ad Algorithms with Java Sprig 08 Stacks ad Queues Moday, February / Tuesday, February Learig Goals Durig this lab, you will: Review stacks ad queues. Lear amortized ruig time aalysis

More information

CIS 121 Data Structures and Algorithms with Java Spring Stacks, Queues, and Heaps Monday, February 18 / Tuesday, February 19

CIS 121 Data Structures and Algorithms with Java Spring Stacks, Queues, and Heaps Monday, February 18 / Tuesday, February 19 CIS Data Structures ad Algorithms with Java Sprig 09 Stacks, Queues, ad Heaps Moday, February 8 / Tuesday, February 9 Stacks ad Queues Recall the stack ad queue ADTs (abstract data types from lecture.

More information

Homework 1 Solutions MA 522 Fall 2017

Homework 1 Solutions MA 522 Fall 2017 Homework 1 Solutios MA 5 Fall 017 1. Cosider the searchig problem: Iput A sequece of umbers A = [a 1,..., a ] ad a value v. Output A idex i such that v = A[i] or the special value NIL if v does ot appear

More information

Sorting in Linear Time. Data Structures and Algorithms Andrei Bulatov

Sorting in Linear Time. Data Structures and Algorithms Andrei Bulatov Sortig i Liear Time Data Structures ad Algorithms Adrei Bulatov Algorithms Sortig i Liear Time 7-2 Compariso Sorts The oly test that all the algorithms we have cosidered so far is compariso The oly iformatio

More information

6.854J / J Advanced Algorithms Fall 2008

6.854J / J Advanced Algorithms Fall 2008 MIT OpeCourseWare http://ocw.mit.edu 6.854J / 18.415J Advaced Algorithms Fall 2008 For iformatio about citig these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. 18.415/6.854 Advaced Algorithms

More information

Computer Science Foundation Exam. August 12, Computer Science. Section 1A. No Calculators! KEY. Solutions and Grading Criteria.

Computer Science Foundation Exam. August 12, Computer Science. Section 1A. No Calculators! KEY. Solutions and Grading Criteria. Computer Sciece Foudatio Exam August, 005 Computer Sciece Sectio A No Calculators! Name: SSN: KEY Solutios ad Gradig Criteria Score: 50 I this sectio of the exam, there are four (4) problems. You must

More information

Hash Tables. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015.

Hash Tables. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015. Presetatio for use with the textbook Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 2015 Hash Tables xkcd. http://xkcd.com/221/. Radom Number. Used with permissio uder Creative

More information

Minimum Spanning Trees

Minimum Spanning Trees Miimum Spaig Trees Miimum Spaig Trees Spaig subgraph Subgraph of a graph G cotaiig all the vertices of G Spaig tree Spaig subgraph that is itself a (free) tree Miimum spaig tree (MST) Spaig tree of a weighted

More information

Pseudocode ( 1.1) Analysis of Algorithms. Primitive Operations. Pseudocode Details. Running Time ( 1.1) Estimating performance

Pseudocode ( 1.1) Analysis of Algorithms. Primitive Operations. Pseudocode Details. Running Time ( 1.1) Estimating performance Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Pseudocode ( 1.1) High-level descriptio of a algorithm More structured

More information

Lecture 5. Counting Sort / Radix Sort

Lecture 5. Counting Sort / Radix Sort Lecture 5. Coutig Sort / Radix Sort T. H. Corme, C. E. Leiserso ad R. L. Rivest Itroductio to Algorithms, 3rd Editio, MIT Press, 2009 Sugkyukwa Uiversity Hyuseug Choo choo@skku.edu Copyright 2000-2018

More information

Basic allocator mechanisms The course that gives CMU its Zip! Memory Management II: Dynamic Storage Allocation Mar 6, 2000.

Basic allocator mechanisms The course that gives CMU its Zip! Memory Management II: Dynamic Storage Allocation Mar 6, 2000. 5-23 The course that gives CM its Zip Memory Maagemet II: Dyamic Storage Allocatio Mar 6, 2000 Topics Segregated lists Buddy system Garbage collectio Mark ad Sweep Copyig eferece coutig Basic allocator

More information

Sorting 9/15/2009. Sorting Problem. Insertion Sort: Soundness. Insertion Sort. Insertion Sort: Running Time. Insertion Sort: Soundness

Sorting 9/15/2009. Sorting Problem. Insertion Sort: Soundness. Insertion Sort. Insertion Sort: Running Time. Insertion Sort: Soundness 9/5/009 Algorithms Sortig 3- Sortig Sortig Problem The Sortig Problem Istace: A sequece of umbers Objective: A permutatio (reorderig) such that a ' K a' a, K,a a ', K, a' of the iput sequece The umbers

More information

CSE 417: Algorithms and Computational Complexity

CSE 417: Algorithms and Computational Complexity Time CSE 47: Algorithms ad Computatioal Readig assigmet Read Chapter of The ALGORITHM Desig Maual Aalysis & Sortig Autum 00 Paul Beame aalysis Problem size Worst-case complexity: max # steps algorithm

More information

Graphs. Minimum Spanning Trees. Slides by Rose Hoberman (CMU)

Graphs. Minimum Spanning Trees. Slides by Rose Hoberman (CMU) Graphs Miimum Spaig Trees Slides by Rose Hoberma (CMU) Problem: Layig Telephoe Wire Cetral office 2 Wirig: Naïve Approach Cetral office Expesive! 3 Wirig: Better Approach Cetral office Miimize the total

More information

CS200: Hash Tables. Prichard Ch CS200 - Hash Tables 1

CS200: Hash Tables. Prichard Ch CS200 - Hash Tables 1 CS200: Hash Tables Prichard Ch. 13.2 CS200 - Hash Tables 1 Table Implemetatios: average cases Search Add Remove Sorted array-based Usorted array-based Balaced Search Trees O(log ) O() O() O() O(1) O()

More information

Data Structures and Algorithms Part 1.4

Data Structures and Algorithms Part 1.4 1 Data Structures ad Algorithms Part 1.4 Werer Nutt 2 DSA, Part 1: Itroductio, syllabus, orgaisatio Algorithms Recursio (priciple, trace, factorial, Fiboacci) Sortig (bubble, isertio, selectio) 3 Sortig

More information

Examples and Applications of Binary Search

Examples and Applications of Binary Search Toy Gog ITEE Uiersity of Queeslad I the secod lecture last week we studied the biary search algorithm that soles the problem of determiig if a particular alue appears i a sorted list of iteger or ot. We

More information

2. ALGORITHM ANALYSIS

2. ALGORITHM ANALYSIS 2. ALGORITHM ANALYSIS computatioal tractability survey of commo ruig times 2. ALGORITHM ANALYSIS computatioal tractability survey of commo ruig times Lecture slides by Kevi Waye Copyright 2005 Pearso-Addiso

More information

Priority Queues. Binary Heaps

Priority Queues. Binary Heaps Priority Queues Biary Heaps Priority Queues Priority: some property of a object that allows it to be prioritized with respect to other objects of the same type Mi Priority Queue: homogeeous collectio of

More information

CSC165H1 Worksheet: Tutorial 8 Algorithm analysis (SOLUTIONS)

CSC165H1 Worksheet: Tutorial 8 Algorithm analysis (SOLUTIONS) CSC165H1, Witer 018 Learig Objectives By the ed of this worksheet, you will: Aalyse the ruig time of fuctios cotaiig ested loops. 1. Nested loop variatios. Each of the followig fuctios takes as iput a

More information

University of Waterloo Department of Electrical and Computer Engineering ECE 250 Algorithms and Data Structures

University of Waterloo Department of Electrical and Computer Engineering ECE 250 Algorithms and Data Structures Uiversity of Waterloo Departmet of Electrical ad Computer Egieerig ECE 250 Algorithms ad Data Structures Midterm Examiatio ( pages) Istructor: Douglas Harder February 7, 2004 7:30-9:00 Name (last, first)

More information

Threads and Concurrency in Java: Part 1

Threads and Concurrency in Java: Part 1 Cocurrecy Threads ad Cocurrecy i Java: Part 1 What every computer egieer eeds to kow about cocurrecy: Cocurrecy is to utraied programmers as matches are to small childre. It is all too easy to get bured.

More information

Threads and Concurrency in Java: Part 1

Threads and Concurrency in Java: Part 1 Threads ad Cocurrecy i Java: Part 1 1 Cocurrecy What every computer egieer eeds to kow about cocurrecy: Cocurrecy is to utraied programmers as matches are to small childre. It is all too easy to get bured.

More information

Ones Assignment Method for Solving Traveling Salesman Problem

Ones Assignment Method for Solving Traveling Salesman Problem Joural of mathematics ad computer sciece 0 (0), 58-65 Oes Assigmet Method for Solvig Travelig Salesma Problem Hadi Basirzadeh Departmet of Mathematics, Shahid Chamra Uiversity, Ahvaz, Ira Article history:

More information

Major CSL Write your name and entry no on every sheet of the answer script. Time 2 Hrs Max Marks 70

Major CSL Write your name and entry no on every sheet of the answer script. Time 2 Hrs Max Marks 70 NOTE:. Attempt all seve questios. Major CSL 02 2. Write your ame ad etry o o every sheet of the aswer script. Time 2 Hrs Max Marks 70 Q No Q Q 2 Q 3 Q 4 Q 5 Q 6 Q 7 Total MM 6 2 4 0 8 4 6 70 Q. Write a

More information

Algorithm Design Techniques. Divide and conquer Problem

Algorithm Design Techniques. Divide and conquer Problem Algorithm Desig Techiques Divide ad coquer Problem Divide ad Coquer Algorithms Divide ad Coquer algorithm desig works o the priciple of dividig the give problem ito smaller sub problems which are similar

More information

APPLICATION NOTE PACE1750AE BUILT-IN FUNCTIONS

APPLICATION NOTE PACE1750AE BUILT-IN FUNCTIONS APPLICATION NOTE PACE175AE BUILT-IN UNCTIONS About This Note This applicatio brief is iteded to explai ad demostrate the use of the special fuctios that are built ito the PACE175AE processor. These powerful

More information

Chapter 11. Friends, Overloaded Operators, and Arrays in Classes. Copyright 2014 Pearson Addison-Wesley. All rights reserved.

Chapter 11. Friends, Overloaded Operators, and Arrays in Classes. Copyright 2014 Pearson Addison-Wesley. All rights reserved. Chapter 11 Frieds, Overloaded Operators, ad Arrays i Classes Copyright 2014 Pearso Addiso-Wesley. All rights reserved. Overview 11.1 Fried Fuctios 11.2 Overloadig Operators 11.3 Arrays ad Classes 11.4

More information

Analysis of Algorithms

Analysis of Algorithms Aalysis of Algorithms Ruig Time of a algorithm Ruig Time Upper Bouds Lower Bouds Examples Mathematical facts Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite

More information

5.3 Recursive definitions and structural induction

5.3 Recursive definitions and structural induction /8/05 5.3 Recursive defiitios ad structural iductio CSE03 Discrete Computatioal Structures Lecture 6 A recursively defied picture Recursive defiitios e sequece of powers of is give by a = for =0,,, Ca

More information

Lecturers: Sanjam Garg and Prasad Raghavendra Feb 21, Midterm 1 Solutions

Lecturers: Sanjam Garg and Prasad Raghavendra Feb 21, Midterm 1 Solutions U.C. Berkeley CS170 : Algorithms Midterm 1 Solutios Lecturers: Sajam Garg ad Prasad Raghavedra Feb 1, 017 Midterm 1 Solutios 1. (4 poits) For the directed graph below, fid all the strogly coected compoets

More information

Heaps. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015

Heaps. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015 Presetatio for use with the textbook Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 201 Heaps 201 Goodrich ad Tamassia xkcd. http://xkcd.com/83/. Tree. Used with permissio uder

More information

Greedy Algorithms. Interval Scheduling. Greedy Algorithms. Interval scheduling. Greedy Algorithms. Interval Scheduling

Greedy Algorithms. Interval Scheduling. Greedy Algorithms. Interval scheduling. Greedy Algorithms. Interval Scheduling Greedy Algorithms Greedy Algorithms Witer Paul Beame Hard to defie exactly but ca give geeral properties Solutio is built i small steps Decisios o how to build the solutio are made to maximize some criterio

More information

How do we evaluate algorithms?

How do we evaluate algorithms? F2 Readig referece: chapter 2 + slides Algorithm complexity Big O ad big Ω To calculate ruig time Aalysis of recursive Algorithms Next time: Litterature: slides mostly The first Algorithm desig methods:

More information

A graphical view of big-o notation. c*g(n) f(n) f(n) = O(g(n))

A graphical view of big-o notation. c*g(n) f(n) f(n) = O(g(n)) ca see that time required to search/sort grows with size of We How do space/time eeds of program grow with iput size? iput. time: cout umber of operatios as fuctio of iput Executio size operatio Assigmet:

More information

Running Time. Analysis of Algorithms. Experimental Studies. Limitations of Experiments

Running Time. Analysis of Algorithms. Experimental Studies. Limitations of Experiments Ruig Time Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects. The

More information

CIS 121 Data Structures and Algorithms with Java Fall Big-Oh Notation Tuesday, September 5 (Make-up Friday, September 8)

CIS 121 Data Structures and Algorithms with Java Fall Big-Oh Notation Tuesday, September 5 (Make-up Friday, September 8) CIS 11 Data Structures ad Algorithms with Java Fall 017 Big-Oh Notatio Tuesday, September 5 (Make-up Friday, September 8) Learig Goals Review Big-Oh ad lear big/small omega/theta otatios Practice solvig

More information

The isoperimetric problem on the hypercube

The isoperimetric problem on the hypercube The isoperimetric problem o the hypercube Prepared by: Steve Butler November 2, 2005 1 The isoperimetric problem We will cosider the -dimesioal hypercube Q Recall that the hypercube Q is a graph whose

More information

Abstract Data Types (ADTs) Stacks. The Stack ADT ( 4.2) Stack Interface in Java

Abstract Data Types (ADTs) Stacks. The Stack ADT ( 4.2) Stack Interface in Java Abstract Data Types (ADTs) tacks A abstract data type (ADT) is a abstractio of a data structure A ADT specifies: Data stored Operatios o the data Error coditios associated with operatios Example: ADT modelig

More information

Solution printed. Do not start the test until instructed to do so! CS 2604 Data Structures Midterm Spring, Instructions:

Solution printed. Do not start the test until instructed to do so! CS 2604 Data Structures Midterm Spring, Instructions: CS 604 Data Structures Midterm Sprig, 00 VIRG INIA POLYTECHNIC INSTITUTE AND STATE U T PROSI M UNI VERSI TY Istructios: Prit your ame i the space provided below. This examiatio is closed book ad closed

More information

Mathematical Stat I: solutions of homework 1

Mathematical Stat I: solutions of homework 1 Mathematical Stat I: solutios of homework Name: Studet Id N:. Suppose we tur over cards simultaeously from two well shuffled decks of ordiary playig cards. We say we obtai a exact match o a particular

More information

Chapter 24. Sorting. Objectives. 1. To study and analyze time efficiency of various sorting algorithms

Chapter 24. Sorting. Objectives. 1. To study and analyze time efficiency of various sorting algorithms Chapter 4 Sortig 1 Objectives 1. o study ad aalyze time efficiecy of various sortig algorithms 4. 4.7.. o desig, implemet, ad aalyze bubble sort 4.. 3. o desig, implemet, ad aalyze merge sort 4.3. 4. o

More information

Running Time ( 3.1) Analysis of Algorithms. Experimental Studies. Limitations of Experiments

Running Time ( 3.1) Analysis of Algorithms. Experimental Studies. Limitations of Experiments Ruig Time ( 3.1) Aalysis of Algorithms Iput Algorithm Output A algorithm is a step- by- step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects.

More information

Analysis of Algorithms

Analysis of Algorithms Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Ruig Time Most algorithms trasform iput objects ito output objects. The

More information

BST Sequence of Operations

BST Sequence of Operations Splay Trees Problems with BSTs Because the shape of a BST is determied by the order that data is iserted, we ru the risk of trees that are essetially lists 12 21 20 32 24 37 15 40 55 56 77 2 BST Sequece

More information

ECE4050 Data Structures and Algorithms. Lecture 6: Searching

ECE4050 Data Structures and Algorithms. Lecture 6: Searching ECE4050 Data Structures ad Algorithms Lecture 6: Searchig 1 Search Give: Distict keys k 1, k 2,, k ad collectio L of records of the form (k 1, I 1 ), (k 2, I 2 ),, (k, I ) where I j is the iformatio associated

More information

Data diverse software fault tolerance techniques

Data diverse software fault tolerance techniques Data diverse software fault tolerace techiques Complemets desig diversity by compesatig for desig diversity s s limitatios Ivolves obtaiig a related set of poits i the program data space, executig the

More information

Algorithm. Counting Sort Analysis of Algorithms

Algorithm. Counting Sort Analysis of Algorithms Algorithm Coutig Sort Aalysis of Algorithms Assumptios: records Coutig sort Each record cotais keys ad data All keys are i the rage of 1 to k Space The usorted list is stored i A, the sorted list will

More information

Chapter 9. Pointers and Dynamic Arrays. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Chapter 9. Pointers and Dynamic Arrays. Copyright 2015 Pearson Education, Ltd.. All rights reserved. Chapter 9 Poiters ad Dyamic Arrays Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 9.1 Poiters 9.2 Dyamic Arrays Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Slide 9-3

More information

why study sorting? Sorting is a classic subject in computer science. There are three reasons for studying sorting algorithms.

why study sorting? Sorting is a classic subject in computer science. There are three reasons for studying sorting algorithms. Chapter 5 Sortig IST311 - CIS65/506 Clevelad State Uiversity Prof. Victor Matos Adapted from: Itroductio to Java Programmig: Comprehesive Versio, Eighth Editio by Y. Daiel Liag why study sortig? Sortig

More information

top() Applications of Stacks

top() Applications of Stacks CS22 Algorithms ad Data Structures MW :00 am - 2: pm, MSEC 0 Istructor: Xiao Qi Lecture 6: Stacks ad Queues Aoucemets Quiz results Homework 2 is available Due o September 29 th, 2004 www.cs.mt.edu~xqicoursescs22

More information

Amortized Analysis. A Simple Analysis. An Amortized Analysis. Incrementing Binary Numbers. A Simple Analysis

Amortized Analysis. A Simple Analysis. An Amortized Analysis. Incrementing Binary Numbers. A Simple Analysis Amortized Analysis The problem domains vary widely, so this approach is not tied to any single data structure The goal is to guarantee the average performance of each operation in the worst case Three

More information

Fundamental Algorithms

Fundamental Algorithms Techische Uiversität Müche Fakultät für Iformatik Lehrstuhl für Effiziete Algorithme Dmytro Chibisov Sadeep Sadaada Witer Semester 2007/08 Solutio Sheet 6 November 30, 2007 Fudametal Algorithms Problem

More information

Lecture Notes 6 Introduction to algorithm analysis CSS 501 Data Structures and Object-Oriented Programming

Lecture Notes 6 Introduction to algorithm analysis CSS 501 Data Structures and Object-Oriented Programming Lecture Notes 6 Itroductio to algorithm aalysis CSS 501 Data Structures ad Object-Orieted Programmig Readig for this lecture: Carrao, Chapter 10 To be covered i this lecture: Itroductio to algorithm aalysis

More information

Data Structures Week #5. Trees (Ağaçlar)

Data Structures Week #5. Trees (Ağaçlar) Data Structures Week #5 Trees Ağaçlar) Trees Ağaçlar) Toros Gökarı Avrupa Gökarı October 28, 2014 Boraha Tümer, Ph.D. 2 Trees Ağaçlar) October 28, 2014 Boraha Tümer, Ph.D. 3 Outlie Trees Deiitios Implemetatio

More information

Overview. Chapter 18 Vectors and Arrays. Reminder. vector. Bjarne Stroustrup

Overview. Chapter 18 Vectors and Arrays. Reminder. vector. Bjarne Stroustrup Chapter 18 Vectors ad Arrays Bjare Stroustrup Vector revisited How are they implemeted? Poiters ad free store Destructors Iitializatio Copy ad move Arrays Array ad poiter problems Chagig size Templates

More information

1.2 Binomial Coefficients and Subsets

1.2 Binomial Coefficients and Subsets 1.2. BINOMIAL COEFFICIENTS AND SUBSETS 13 1.2 Biomial Coefficiets ad Subsets 1.2-1 The loop below is part of a program to determie the umber of triagles formed by poits i the plae. for i =1 to for j =

More information

. Written in factored form it is easy to see that the roots are 2, 2, i,

. Written in factored form it is easy to see that the roots are 2, 2, i, CMPS A Itroductio to Programmig Programmig Assigmet 4 I this assigmet you will write a java program that determies the real roots of a polyomial that lie withi a specified rage. Recall that the roots (or

More information

6.851: Advanced Data Structures Spring Lecture 17 April 24

6.851: Advanced Data Structures Spring Lecture 17 April 24 6.851: Advaced Data Structures Sprig 2012 Prof. Erik Demaie Lecture 17 April 24 Scribes: David Bejami(2012), Li Fei(2012), Yuzhi Zheg(2012),Morteza Zadimoghaddam(2010), Aaro Berstei(2007) 1 Overview Up

More information

A New Morphological 3D Shape Decomposition: Grayscale Interframe Interpolation Method

A New Morphological 3D Shape Decomposition: Grayscale Interframe Interpolation Method A ew Morphological 3D Shape Decompositio: Grayscale Iterframe Iterpolatio Method D.. Vizireau Politehica Uiversity Bucharest, Romaia ae@comm.pub.ro R. M. Udrea Politehica Uiversity Bucharest, Romaia mihea@comm.pub.ro

More information

Outline and Reading. Analysis of Algorithms. Running Time. Experimental Studies. Limitations of Experiments. Theoretical Analysis

Outline and Reading. Analysis of Algorithms. Running Time. Experimental Studies. Limitations of Experiments. Theoretical Analysis Outlie ad Readig Aalysis of Algorithms Iput Algorithm Output Ruig time ( 3.) Pseudo-code ( 3.2) Coutig primitive operatios ( 3.3-3.) Asymptotic otatio ( 3.6) Asymptotic aalysis ( 3.7) Case study Aalysis

More information

Random Graphs and Complex Networks T

Random Graphs and Complex Networks T Radom Graphs ad Complex Networks T-79.7003 Charalampos E. Tsourakakis Aalto Uiversity Lecture 3 7 September 013 Aoucemet Homework 1 is out, due i two weeks from ow. Exercises: Probabilistic iequalities

More information

Minimum Spanning Trees

Minimum Spanning Trees Presetatio for use with the textbook, lgorithm esig ad pplicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 0 Miimum Spaig Trees 0 Goodrich ad Tamassia Miimum Spaig Trees pplicatio: oectig a Network Suppose

More information

Design and Analysis of Algorithms Notes

Design and Analysis of Algorithms Notes Desig ad Aalysis of Algorithms Notes Notes by Wist Course taught by Dr. K Amer Course started: Jauary 4, 013 Course eded: December 13, 01 Curret geeratio: December 18, 013 Listigs 1 Array sum pseudocode.................................

More information

Data Structures Week #9. Sorting

Data Structures Week #9. Sorting Data Structures Week #9 Sortig Outlie Motivatio Types of Sortig Elemetary (O( 2 )) Sortig Techiques Other (O(*log())) Sortig Techiques 21.Aralık.2010 Boraha Tümer, Ph.D. 2 Sortig 21.Aralık.2010 Boraha

More information

CMPT 125 Assignment 2 Solutions

CMPT 125 Assignment 2 Solutions CMPT 25 Assigmet 2 Solutios Questio (20 marks total) a) Let s cosider a iteger array of size 0. (0 marks, each part is 2 marks) it a[0]; I. How would you assig a poiter, called pa, to store the address

More information

Minimum Spanning Trees. Application: Connecting a Network

Minimum Spanning Trees. Application: Connecting a Network Miimum Spaig Tree // : Presetatio for use with the textbook, lgorithm esig ad pplicatios, by M. T. oodrich ad R. Tamassia, Wiley, Miimum Spaig Trees oodrich ad Tamassia Miimum Spaig Trees pplicatio: oectig

More information

quality/quantity peak time/ratio

quality/quantity peak time/ratio Semi-Heap ad Its Applicatios i Touramet Rakig Jie Wu Departmet of omputer Sciece ad Egieerig Florida Atlatic Uiversity oca Rato, FL 3343 jie@cse.fau.edu September, 00 . Itroductio ad Motivatio. relimiaries

More information

Analysis of Algorithms

Analysis of Algorithms Presetatio for use with the textbook, Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 2015 Aalysis of Algorithms Iput 2015 Goodrich ad Tamassia Algorithm Aalysis of Algorithms

More information

condition w i B i S maximum u i

condition w i B i S maximum u i ecture 10 Dyamic Programmig 10.1 Kapsack Problem November 1, 2004 ecturer: Kamal Jai Notes: Tobias Holgers We are give a set of items U = {a 1, a 2,..., a }. Each item has a weight w i Z + ad a utility

More information

Arithmetic Sequences

Arithmetic Sequences . Arithmetic Sequeces COMMON CORE Learig Stadards HSF-IF.A. HSF-BF.A.1a HSF-BF.A. HSF-LE.A. Essetial Questio How ca you use a arithmetic sequece to describe a patter? A arithmetic sequece is a ordered

More information

CSE 2320 Notes 8: Sorting. (Last updated 10/3/18 7:16 PM) Idea: Take an unsorted (sub)array and partition into two subarrays such that.

CSE 2320 Notes 8: Sorting. (Last updated 10/3/18 7:16 PM) Idea: Take an unsorted (sub)array and partition into two subarrays such that. CSE Notes 8: Sortig (Last updated //8 7:6 PM) CLRS 7.-7., 9., 8.-8. 8.A. QUICKSORT Cocepts Idea: Take a usorted (sub)array ad partitio ito two subarrays such that p q r x y z x y y z Pivot Customarily,

More information

Data Structures and Algorithms. Analysis of Algorithms

Data Structures and Algorithms. Analysis of Algorithms Data Structures ad Algorithms Aalysis of Algorithms Outlie Ruig time Pseudo-code Big-oh otatio Big-theta otatio Big-omega otatio Asymptotic algorithm aalysis Aalysis of Algorithms Iput Algorithm Output

More information

15-859E: Advanced Algorithms CMU, Spring 2015 Lecture #2: Randomized MST and MST Verification January 14, 2015

15-859E: Advanced Algorithms CMU, Spring 2015 Lecture #2: Randomized MST and MST Verification January 14, 2015 15-859E: Advaced Algorithms CMU, Sprig 2015 Lecture #2: Radomized MST ad MST Verificatio Jauary 14, 2015 Lecturer: Aupam Gupta Scribe: Yu Zhao 1 Prelimiaries I this lecture we are talkig about two cotets:

More information

Lecture 5: Recursion. Recursion Overview. Recursion is a powerful technique for specifying funclons, sets, and programs

Lecture 5: Recursion. Recursion Overview. Recursion is a powerful technique for specifying funclons, sets, and programs CS/ENGRD 20 Object- Orieted Programmig ad Data Structures Sprig 202 Doug James Visual Recursio Lecture : Recursio http://seredip.brymawr.edu/exchage/files/authors/faculty/39/literarykids/ifiite_mirror.jpg!

More information

Computational Geometry

Computational Geometry Computatioal Geometry Chapter 4 Liear programmig Duality Smallest eclosig disk O the Ageda Liear Programmig Slides courtesy of Craig Gotsma 4. 4. Liear Programmig - Example Defie: (amout amout cosumed

More information

1 Graph Sparsfication

1 Graph Sparsfication CME 305: Discrete Mathematics ad Algorithms 1 Graph Sparsficatio I this sectio we discuss the approximatio of a graph G(V, E) by a sparse graph H(V, F ) o the same vertex set. I particular, we cosider

More information

Lecture 6. Lecturer: Ronitt Rubinfeld Scribes: Chen Ziv, Eliav Buchnik, Ophir Arie, Jonathan Gradstein

Lecture 6. Lecturer: Ronitt Rubinfeld Scribes: Chen Ziv, Eliav Buchnik, Ophir Arie, Jonathan Gradstein 068.670 Subliear Time Algorithms November, 0 Lecture 6 Lecturer: Roitt Rubifeld Scribes: Che Ziv, Eliav Buchik, Ophir Arie, Joatha Gradstei Lesso overview. Usig the oracle reductio framework for approximatig

More information

Graphs. Shortest Path and Topological Sort

Graphs. Shortest Path and Topological Sort Graphs Shortest Path ad Topological Sort Example Relatioal Networks School Friedship Network (from Moody 2001) Yeast Metabolic Network (from https://www.d.edu/~etworks/cell/) Terrorist Network (by Valdis

More information

The Magma Database file formats

The Magma Database file formats The Magma Database file formats Adrew Gaylard, Bret Pikey, ad Mart-Mari Breedt Johaesburg, South Africa 15th May 2006 1 Summary Magma is a ope-source object database created by Chris Muller, of Kasas City,

More information

arxiv: v2 [cs.ds] 24 Mar 2018

arxiv: v2 [cs.ds] 24 Mar 2018 Similar Elemets ad Metric Labelig o Complete Graphs arxiv:1803.08037v [cs.ds] 4 Mar 018 Pedro F. Felzeszwalb Brow Uiversity Providece, RI, USA pff@brow.edu March 8, 018 We cosider a problem that ivolves

More information

COP 4531 Complexity & Analysis of Data Structures & Algorithms

COP 4531 Complexity & Analysis of Data Structures & Algorithms COP 4531 Complexity & Analysis of Data Structures & Algorithms Amortized Analysis Thanks to the text authors who contributed to these slides What is amortized analysis? Analyze a sequence of operations

More information

Python Programming: An Introduction to Computer Science

Python Programming: An Introduction to Computer Science Pytho Programmig: A Itroductio to Computer Sciece Chapter 6 Defiig Fuctios Pytho Programmig, 2/e 1 Objectives To uderstad why programmers divide programs up ito sets of cooperatig fuctios. To be able to

More information

n n B. How many subsets of C are there of cardinality n. We are selecting elements for such a

n n B. How many subsets of C are there of cardinality n. We are selecting elements for such a 4. [10] Usig a combiatorial argumet, prove that for 1: = 0 = Let A ad B be disjoit sets of cardiality each ad C = A B. How may subsets of C are there of cardiality. We are selectig elemets for such a subset

More information

CIS 121. Introduction to Trees

CIS 121. Introduction to Trees CIS 121 Itroductio to Trees 1 Tree ADT Tree defiitio q A tree is a set of odes which may be empty q If ot empty, the there is a distiguished ode r, called root ad zero or more o-empty subtrees T 1, T 2,

More information

Computers and Scientific Thinking

Computers and Scientific Thinking Computers ad Scietific Thikig David Reed, Creighto Uiversity Chapter 15 JavaScript Strigs 1 Strigs as Objects so far, your iteractive Web pages have maipulated strigs i simple ways use text box to iput

More information

Analysis Metrics. Intro to Algorithm Analysis. Slides. 12. Alg Analysis. 12. Alg Analysis

Analysis Metrics. Intro to Algorithm Analysis. Slides. 12. Alg Analysis. 12. Alg Analysis Itro to Algorithm Aalysis Aalysis Metrics Slides. Table of Cotets. Aalysis Metrics 3. Exact Aalysis Rules 4. Simple Summatio 5. Summatio Formulas 6. Order of Magitude 7. Big-O otatio 8. Big-O Theorems

More information

Module 8-7: Pascal s Triangle and the Binomial Theorem

Module 8-7: Pascal s Triangle and the Binomial Theorem Module 8-7: Pascal s Triagle ad the Biomial Theorem Gregory V. Bard April 5, 017 A Note about Notatio Just to recall, all of the followig mea the same thig: ( 7 7C 4 C4 7 7C4 5 4 ad they are (all proouced

More information

COSC 1P03. Ch 7 Recursion. Introduction to Data Structures 8.1

COSC 1P03. Ch 7 Recursion. Introduction to Data Structures 8.1 COSC 1P03 Ch 7 Recursio Itroductio to Data Structures 8.1 COSC 1P03 Recursio Recursio I Mathematics factorial Fiboacci umbers defie ifiite set with fiite defiitio I Computer Sciece sytax rules fiite defiitio,

More information

Lower Bounds for Sorting

Lower Bounds for Sorting Liear Sortig Topics Covered: Lower Bouds for Sortig Coutig Sort Radix Sort Bucket Sort Lower Bouds for Sortig Compariso vs. o-compariso sortig Decisio tree model Worst case lower boud Compariso Sortig

More information

Lecture 1: Introduction and Strassen s Algorithm

Lecture 1: Introduction and Strassen s Algorithm 5-750: Graduate Algorithms Jauary 7, 08 Lecture : Itroductio ad Strasse s Algorithm Lecturer: Gary Miller Scribe: Robert Parker Itroductio Machie models I this class, we will primarily use the Radom Access

More information

Morgan Kaufmann Publishers 26 February, COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. Chapter 5

Morgan Kaufmann Publishers 26 February, COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. Chapter 5 Morga Kaufma Publishers 26 February, 28 COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Iterface 5 th Editio Chapter 5 Set-Associative Cache Architecture Performace Summary Whe CPU performace icreases:

More information

Reliable Transmission. Spring 2018 CS 438 Staff - University of Illinois 1

Reliable Transmission. Spring 2018 CS 438 Staff - University of Illinois 1 Reliable Trasmissio Sprig 2018 CS 438 Staff - Uiversity of Illiois 1 Reliable Trasmissio Hello! My computer s ame is Alice. Alice Bob Hello! Alice. Sprig 2018 CS 438 Staff - Uiversity of Illiois 2 Reliable

More information

Linked Lists 11/16/18. Preliminaries. Java References. Objects and references. Self references. Linking self-referential nodes

Linked Lists 11/16/18. Preliminaries. Java References. Objects and references. Self references. Linking self-referential nodes Prelimiaries Liked Lists public class StrageObject { Strig ame; StrageObject other; Arrays are ot always the optimal data structure: A array has fixed size eeds to be copied to expad its capacity Addig

More information

1. SWITCHING FUNDAMENTALS

1. SWITCHING FUNDAMENTALS . SWITCING FUNDMENTLS Switchig is the provisio of a o-demad coectio betwee two ed poits. Two distict switchig techiques are employed i commuicatio etwors-- circuit switchig ad pacet switchig. Circuit switchig

More information

Speeding-up dynamic programming in sequence alignment

Speeding-up dynamic programming in sequence alignment Departmet of Computer Sciece Aarhus Uiversity Demark Speedig-up dyamic programmig i sequece aligmet Master s Thesis Dug My Hoa - 443 December, Supervisor: Christia Nørgaard Storm Pederse Implemetatio code

More information

Symbolic Execution with Abstraction

Symbolic Execution with Abstraction Software Tools for Techology Trasfer mauscript No. (will be iserted by the editor) Symbolic Executio with Abstractio Saswat Aad 1, Coria S. Păsăreau 2, Willem Visser 3 1 College of Computig, Georgia Istitute

More information

CS 111: Program Design I Lecture # 7: First Loop, Web Crawler, Functions

CS 111: Program Design I Lecture # 7: First Loop, Web Crawler, Functions CS 111: Program Desig I Lecture # 7: First Loop, Web Crawler, Fuctios Robert H. Sloa & Richard Warer Uiversity of Illiois at Chicago September 18, 2018 What will this prit? x = 5 if x == 3: prit("hi!")

More information

Xiaozhou (Steve) Li, Atri Rudra, Ram Swaminathan. HP Laboratories HPL Keyword(s): graph coloring; hardness of approximation

Xiaozhou (Steve) Li, Atri Rudra, Ram Swaminathan. HP Laboratories HPL Keyword(s): graph coloring; hardness of approximation Flexible Colorig Xiaozhou (Steve) Li, Atri Rudra, Ram Swamiatha HP Laboratories HPL-2010-177 Keyword(s): graph colorig; hardess of approximatio Abstract: Motivated b y reliability cosideratios i data deduplicatio

More information