6.851: Advanced Data Structures Spring Lecture 17 April 24
|
|
- Joshua Powell
- 5 years ago
- Views:
Transcription
1 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 util ow, we have maily studied how to decrease the query time, ad the preprocessig time of our data structures. I this lecture, we will focus o maitaiig the data as compactly as possible. The for this sectio is to get very small space, that is ofte for static data structure. Goig to look a biary tries, usig biary alphabets. Aother way is to use bit strigs. It is easy to do liear space, it it is ot optimal. Our goal will be to get as close the iformatio theoretic optimum as possible. We will refer to this optimum as OPT. Note that most liear space data structures we have see are still far from the iformatio theoretic optimum because they typically use O() words of space, whereas OPT usually uses O() bits. This strict space limitatio makes it really hard to have dyamic data structures, so most space-efficiet data structures are static. Here are some possible goals we ca strive for: Implicit Data Structures Space = iformatio-theoretic-opt + O(1). Focusig o bits, ot words. The ideal is to use O() bits. The O(1) is there so that we ca roud up if OPT is fractioal. Most implicit data structures just store some permutatio of the data: that is all we ca really do. As some simple examples, we ca refer to Heap which is a Implicit Dyamic Data Structure, ad Sorted array which is static example of these data structures. Succict Data Structures Space = OPT + o(opt). I other words, the leadig costat is 1. This is the most commo type of space-efficiet Data Structures. Compact Data Structures Space = O(OPT). Note that some liear space data structures are ot actually compact because they use O(w OPT) bits. This saves at least a O(w) from the ormal data structures. For example, suffix tree has O() words space, but its iformatio theoretic lower boud is bits. O the other had, BST ca be see as a Compact Data Structure. Succict is the usual goal here. Implicit is very hard, ad compact is geerally to work towards a succict data structure. 1.1 mii-survey Implicit Dyamic Search Tree Static search trees ca be stored i a array with l per search. However, i order to iserts ad deletes makes the problem more tricky. There 1
2 is a old results that was doe i lg 2 usig poiters ad permutatio of the bits I 2003, Fraceschii ad Grossi [1] developed a implicitly dyamic search tree which supports isert, delete, ad predecessor i O(log()) time worst case, ad it is cache-oblivious. Succict Dictioary This is static, which has o iserts ad deletes. I a uiverse of size u, how may ways are there to have items. Use lg ( ) ( u lg ( u +O ) ( lg lg lg u) bits [2] or lg u ) +O( (lg lg ) 2 lg ) bits [6], ad support O(1) membership queries, same amout of time but with less space tha ormal dictioaries; u is the size of the uiverse from which the elemets are draw. Succict Biary Tries The umber of possible biary tries with odes is the th Catala umber, C = ( )/( u + 1) 4. Thus, OP T log(4 ) = 2. We ote that this ca be derived from a recursio formula based o the sizes of the left ad right subtrees of the root. I this lecture, we will show how to use 2 + o() bits of space. We will be able to fid the left child, the right child, ad the paret i O(1) time. We will also give some ituitio for how to aswer subtree-size queries i O(1) time. Subtree size is importat because it allows us to keep track of the rak of the ode we are at. Motivatio behid the research was to fit the Oxford dictioary oto a CD, where space was limited. Almost Succict k-ary trie The umber of such tries is C k = ( ) k+1 /(k+1) 2 (log(k)+log(e)). Thus, OPT = (log(k) + log(e)). The best kow data structures was developed by Beoit et al. [3]. It uses ( log(k) + log(e) ) + o() + O(loglog(k)) bits. This represetatio still supports the followig queries i O(1) time: fid child with label i, fid paret, ad fid subtree size. Succict Rooted Ordered Trees These are differet from tries because there ca be o abset childre. The umber of possible trees is C, so OPT = 2. A query ca ask us to fid the ith child of a ode, the paret of a ode, or the subtree size of a ode. Clark ad Muro [4] gave a succict data structure which uses 2 + o() space, ad aswers queries i costat time. Succict Permutatio I this data structure, we are give a permutatio π of items, ad the queries are of the form π k (i). Muro et. al. preset a data structure with costat query time ad space (1 + ɛ) log() + O(1) bits i [7]. They also obtai a succict data structure with log! + o() bits ad query time O(log / log log ). Compact Abelia groups Represet abelia group o items usig O(lg ) bits, ad represet a item i that list with lg bits. Graphs More complicated. We did ot go over ay details i class. Itegers Implicit -bit umber of itegers ca do icremet or decremet i O(lg ) bits reads ad O(1) bit writes. OPEN: O(1) word operatios. 2 Level Order Represetatio of Biary Tries As oted above, the iformatio theoretic optimum size for a biary trie is 2 bits, two bits per ode. To build a succict biary trie, we must represet the structure of the trie i 2 + o() bits. 2
3 We represet tries usig the level order represetatio. Visit the odes i level order (that is, level by level startig from the top, left-to-right withi a level), writig out two bits for each ode. Each bit describes a child of the ode: if it has a left child, the first bit is 1, otherwise 0. Likewise, the secod bit represets whether it has a right child. As a example, cosider the followig trie: We traverse the odes i order A, B, C, D, E, F, G. This results i the bit strig: A B C D E F G Exteral ode formulatio Equivaletly, we ca associate each bit with the child, as opposed to the paret. For every missig leaf, we add a exteral ode, represeted by i the above diagram. The origial odes are called iteral odes. We agai visit each ode i level order, addig 1 for iteral odes ad 0 for exteral odes. A tree with odes has + 1 missig leaves, so this results i bits. For the above example, this results i the followig bit strig: A B C D E F G Note this ew bit strig is idetical to the previous but for a extra 1 prepeded for the root, A. 2.1 Navigatig This represetatio allows us to compute left child, right child, ad paret i costat. It does ot, however, allow computig subtree size. We begi by provig the the followig theorem: Theorem 1. I the exteral ode formulatio, the left ad right childre of the ith iteral ode are at positios 2i ad 2i
4 Proof. We prove this by iductio o i. For i = 1, the root, this is clearly true. The first etry of the bit strig is for the root. The bits 2i = 2 ad 2i + 1 = 3 are the childre of the root. Now, for i > 1, by the iductive hypothesis, the childre of the i 1st iteral ode are at positios 2(i 1) = 2i 2 ad 2(i 1)+1 = 2i 1. We show that the childre of the ith iteral immediately follow the i 1st iteral ode s childre. Visually, there are two cases: either i 1 is o the same level as i or i is o the ext level. I the secod case, i 1 ad i are the last ad first iteral odes i their levels, respectively. Figure 1: i 1 ad i are o the same level. Figure 2: i 1 ad i are differet levels. Level orderig is preserved i childre, that is, A s childre precede B s childre i the level orderig if ad oly if A precedes B. All odes betwee the i 1st iteral ode ad the ith iteral ode are exteral odes with o childre, so the childre of the ith iteral ode immediately follow the childre of the i 1st iteral ode, at positios 2i ad 2i + 1. As a corollary, the paret of bit positio i is i/2. Note that we have two methods of coutig bits: we may either cout bit positios or rak oly by 1s. If we could traslate betwee the two i O(1) time, we could avigate the tree efficietly. 4
5 3 Rak ad Select Now we eed to establish a correspodece betwee positios i the -bit strig ad actual iteral ode umber i the biary tree. Say that we could support the followig operatios o a -bit strig i O(1) time, with o() extra space: rak(i) = umber of 1 s at or before positio i select(j) = positio of jth oe. This would give us the desired represetatio of the biary trie. The space requiremet would be 2 for the level-order represetatio, ad o() space for rak/select. Here is how we would support queries: left-child(i) = 2rak(i) right-child(i) = 2rak(i) + 1 paret(i) = select( i/2 ) Note that level-ordered trees do ot support queries such as subtree-size. This ca be doe i the balaced paretheses represetatio, however. 3.1 Rak This algorithm was developed by Jacobse, i 1989 [5]. It uses may of the same ideas as RMQ. The basic idea is that we use a costat umber of recursios util we get dow to sub-problems of size k = lg()/2. Note that there are oly 2 k = possible strigs of size k, so we will just store a lookup table for all possible bit strigs of size k. For each such strig we have k = O(log()) possible queries, ad it takes log(k) bits to store the solutio of each query (the rak of that elemet). Noetheless, this is still oly O(2 k k log k) = O( lg() lg lg()) = o() bits. Notice that a aive divisio of the etire -bit strig ito chuks of size 1 2 lg does ot work. because we eed to save lg relative idices, each takig up to lg bits, for a total of Θ() bits, which is too much. Thus, we eed to use a techique that uses idirectio twice. Step 1: We build a lookup table for bit strigs of legth 1 2 lg. As we argued before, this takes O( lg lg lg ) = o() bits of space. Step 2: Split the the -bit strig ito (lg 2 )-bit chuks. At the ed of each chuk, we store the cumulative rak so far. Each cumulative rak would take lg bits. Ad there are at most / lg 2 chuks. Thus, the total space required is O( lg ) = O( lg 2 lg ) bits Step 3: Now we eed to split each chuk ito ( 1 2 lg )-bit sub-chuks. The, at the ed of each sub-chuk, we store the cumulative rak withi each chuk. Sice each chuk oly has size lg 2, we oly eed lg lg bits for each idex. There are at most O(/ lg ) sub-chuks. Thus, the total space required is O( lg lg lg ) = o() bits. Notice how we saved space because the size of the cumulative rak withi each small chuk is less. 5
6 Figure 3: Divisio of bit strig ito chuks ad sub-chuks, as i the rak algorithm Step 4: To fid the total rak, we just do: Rak = rak of chuk + relative rak of sub-chuk withi chuk + relative rak of elemet withi sub-chuk (via lookup table). lg lg This algorithm rus i O(1) time, ad it oly takes O( lg ) bits. It is i fact possible to improve the space to O( i class. lg k ) bits for ay costat k. But this is ot covered 3.2 Select This algorithm was developed by Clark ad Muro i 1996 [4]. Select is similar to rak, although more complicated. This time, sice we are tryig to fid the positio of the ith oe, we will break our array up ito chuks with equal amouts of oes, as opposed to chuks of equal size. Step 1: First, we will pick every (lg lg lg )th 1 to be a special oe. We will store the idex of every special oe. Storig a idex takes lg bits, so this will take O( lg /(lg lg lg )) = O(/ lg lg ) = o(). The, give a query, we ca fid divide it by lg lg lg to teleport to the correct chuk cotaiig our desired result. Step 2: Now, we eed to restrict our attetio to a sigle chuk, which cotais lg lg lg 1 bit. Let r be the total umber of bits i a chuk. If r > (lg lg lg ) 2 bits: This is whe the 1 bits are sparse. Thus, we ca afford to store a array of idices of every 1 bit 6
7 Figure 4: Divisio of bit strig ito ueve chuks each cotaiig the same umber of 1 s, as i the select algorithm i this chuk. There are (lg lg lg ) 1 bits. Storig each would take up at most lg space (The size of the chuk is already polylog(), so lg bits is more tha eough). Ad there are at most such sparse chuks. So, i total, we use space: (lg lg lg ) 2 O( (lg lg lg ) lg ) = o( (lg lg lg ) 2 lg lg ) bits. If r < (lg lg lg ) 2 bits: We have reduced to a bit strig of legth r (lg lg lg ) 2. This is good, because aalogously to Rak, these chuks are small eough to be divided ito sub-chuks without requirig too much space for storig the sub-chuk s relative idices. Step 3: We basically repeat steps 1 ad 2 o all reduced bit strigs, ad further reduce them ito bit strigs of legth (lg lg ) O(1). Step 1 : With the reduced chuks of legth O(lg lg lg ) 2, we agai pick out special 1 s, ad divide it ito every (lg lg ) 2 th 1 bit. Sice withi each chuk, the relative idex oly takes O(lg lg ) bits, the total space required is: O( lg lg ) = O( (lg lg ) 2 lg lg ) bits. Step 2 : Withi groups of (lg lg ) 2 1 bits, say it has r bits total: if r (lg lg ) 4, the store relative idices of 1 bits. There are (lg lg ) 4 such groups, withi each there are (lg lg ) 2 1 bits, ad each relative idex takes lg lg bits to store. For a total of: O( (lg lg ) 2 lg lg ) = O( (lg lg ) 4 lg lg ) bits. if r < (lg lg ) 4, the r < 1 2 lg. The it is small eough for us to use step 4: Step 4: use lookup table for bit strig of legth 1 2 lg. Like i rak, the total space for the lookup table is at most: O( lg lg lg ). Thus, we agai have O(1) query time ad O( lg lg 7 ) bits space.
8 Agai, this result ca be improved to O(/ lg k ) bits for ay costat k, but we will ot show it here. 4 Subtree Sizes We have show a Succict biary trie which allows us to fid left childre, right childre, ad parets. But we would still like to fid sub-tree size i O(1) time. Level order represetatio does ot work for this, because level order gives o iformatio about depth. Thus, we will istead try to ecode our odes i depth first order. I order to do this, otice that there are C (catala umber) biary tries o odes. But there are also C rooted ordered trees o odes, ad there are C balaced paretheses strigs with paretheses. Moreover, we will describe a bijectio: biary tries rooted ordered trees balaced paretheses. This makes the problem much easier because we ca work with balaced paretheses, which have a atural bit ecodig: 1 for a ope paretheses, 0 for a closed oe. 4.1 The Bijectios Figure 5: A example biary trie with circled right spie. We will use the biary trie i Figure 5. Fidig the right spie of the trie, the recurse util every ode lives i a spie. To make this ito a rooted ordered tree, we ca thik of rotatig the trie 45 degrees couter-clockwise. Thus, the top three odes of the tree will be the right spie of the trie (A,C,F). To make the tree rooted, we will add a extra root *. Now, we recurse ito the left subtrees of A,C, ad F. For A, the right spie is just B,D,G. For C, the right spie is just E: C s oly left child. Figure 6 shows the resultig rooted ordered tree. There is a bijectio betwee the two represetatios. To go from rooted ordered trees to balaced paretheses strigs, we do a DFS (or Euler tour) of the ordered tree. We will the put a ope paretheses whe we first touch a ode, ad the a closed paretheses the secod time we touch it. Figure 7 cotais a paretheses represetatio of the ordered tree i Figure 2. 8
9 Figure 6: A Rooted Ordered Tree That Represets the Trie i Figure 5. ( ( ( ) ( ) ( ) ) ( ( ) ) ( ) ) * A B B C C D D A E F F G G E * Figure 7: A Balaced Paretheses Strig That Represets the Ordered Tree i Figure 6 Now, we will show how the queries are trasformed by this bijectio. For example, if we wat to fid the paret i our biary trie, what does this correspod to i the paretheses strig? The bold-face is what we have i the biary trie, ad uder that, we will describe the correspodig queries from the 2 bijectios. Biary Trie Rooted Ordered Tree Balaced Paretheses Node Node Left Pare[ ad matchig right] Left Child First Child Next char [if (, else oe] Right Child Next Siblig Char after matchig ) [if ( ] Paret Previous Siblig or Paret if prev char ), its mathcig ( ; if (, that ( Subtree size size(ode)+size(right sibligs) 1/2 distace to eclosig ) Could use rak ad select to fid the matchig parethesis for the balaced parethesis represetatio. Refereces [1] G. Fraseschii, R.Grossi Optimal Worst-case Operatios for Implicit Cache-Oblivious Search Trees, Proocedig of the 8th Iteratioal Workshop o Algorithms ad Data Structures (WADS), , 2003 [2] A.Brodik, I.Muro Membership i Costat Time ad Almost Miimum Space, Siam J. Computig, 28(5): , 1999 [3] D.Beoit, E.Demaie, I.Muro, R.Rama, V.Rama, S.Rao Represetig Trees of Higher Degree, Algorithmica 43(4): , 2005 [4] D.Clark, I.Muro Eifficet Suffix Trees o Secodary Storage, SODA, , [5] G.Jacobso Succict Static Data Structures, PHD.Thesis, Caregie Mello Uiversity,
10 [6] R. Pagh: Low Redudacy i Static Dictioaries with Costat Query Time, SIAM Joural of Computig 31(2): (2001). [7] J. Ia Muro, Rajeev Rama, Vekatesh Rama, ad Satti Sriivasa Rao: Succict Represetatios of Permutatios, ICALP (2003), LNCS 2719, pp
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 informationHeaps. 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 informationLecture 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 informationcondition 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 informationCIS 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 informationCIS 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 informationLecture 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 information15-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 informationBasic 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 informationThe 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 information6.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 informationCIS 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 informationThompson s Group F (p + 1) is not Minimally Almost Convex
Thompso s Group F (p + ) is ot Miimally Almost Covex Claire Wladis Thompso s Group F (p + ). A Descriptio of F (p + ) Thompso s group F (p + ) ca be defied as the group of piecewiseliear orietatio-preservig
More informationPriority 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 informationOnes 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 informationThe 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 informationLecture 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 informationHow 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 informationMinimum 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 informationSorting 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 informationModule 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 information1 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 informationLower 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Σ P(i) ( depth T (K i ) + 1),
EECS 3101 York Uiversity Istructor: Ady Mirzaia DYNAMIC PROGRAMMING: OPIMAL SAIC BINARY SEARCH REES his lecture ote describes a applicatio of the dyamic programmig paradigm o computig the optimal static
More informationCS211 Fall 2003 Prelim 2 Solutions and Grading Guide
CS11 Fall 003 Prelim Solutios ad Gradig Guide Problem 1: (a) obj = obj1; ILLEGAL because type of referece must always be a supertype of type of object (b) obj3 = obj1; ILLEGAL because type of referece
More informationLecture 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 informationBST 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 informationCombination Labelings Of Graphs
Applied Mathematics E-Notes, (0), - c ISSN 0-0 Available free at mirror sites of http://wwwmaththuedutw/ame/ Combiatio Labeligs Of Graphs Pak Chig Li y Received February 0 Abstract Suppose G = (V; E) is
More informationPseudocode ( 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 informationComputers 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 informationDATA STRUCTURES. amortized analysis binomial heaps Fibonacci heaps union-find. Data structures. Appetizer. Appetizer
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
More informationChapter 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 informationComputational 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 informationLecturers: 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 informationSolution 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 informationCSC165H1 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 informationPattern Recognition Systems Lab 1 Least Mean Squares
Patter Recogitio Systems Lab 1 Least Mea Squares 1. Objectives This laboratory work itroduces the OpeCV-based framework used throughout the course. I this assigmet a lie is fitted to a set of poits usig
More informationChapter 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 informationHomework 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 informationA 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 informationMajor 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 informationCSE 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 informationProtected points in ordered trees
Applied Mathematics Letters 008 56 50 www.elsevier.com/locate/aml Protected poits i ordered trees Gi-Sag Cheo a, Louis W. Shapiro b, a Departmet of Mathematics, Sugkyukwa Uiversity, Suwo 440-746, Republic
More informationExamples 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 informationAlgorithm 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 informationUNIT 1 RECURRENCE RELATIONS
UNIT RECURRENCE RELATIONS Structure Page No.. Itroductio 7. Objectives 7. Three Recurret Problems 8.3 More Recurreces.4 Defiitios 4.5 Divide ad Coquer 7.6 Summary 9.7 Solutios/Aswers. INTRODUCTION I the
More informationCIS 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 information1.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 informationwhy 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 informationHash 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 informationAssignment 5; Due Friday, February 10
Assigmet 5; Due Friday, February 10 17.9b The set X is just two circles joied at a poit, ad the set X is a grid i the plae, without the iteriors of the small squares. The picture below shows that the iteriors
More informationChapter 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 informationThe number n of subintervals times the length h of subintervals gives length of interval (b-a).
Simulator with MadMath Kit: Riema Sums (Teacher s pages) I your kit: 1. GeoGebra file: Ready-to-use projector sized simulator: RiemaSumMM.ggb 2. RiemaSumMM.pdf (this file) ad RiemaSumMMEd.pdf (educator's
More informationFast Fourier Transform (FFT) Algorithms
Fast Fourier Trasform FFT Algorithms Relatio to the z-trasform elsewhere, ozero, z x z X x [ ] 2 ~ elsewhere,, ~ e j x X x x π j e z z X X π 2 ~ The DFS X represets evely spaced samples of the z- trasform
More informationLoad balanced Parallel Prime Number Generator with Sieve of Eratosthenes on Cluster Computers *
Load balaced Parallel Prime umber Geerator with Sieve of Eratosthees o luster omputers * Soowook Hwag*, Kyusik hug**, ad Dogseug Kim* *Departmet of Electrical Egieerig Korea Uiversity Seoul, -, Rep. of
More informationData 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 informationPolynomial Functions and Models. Learning Objectives. Polynomials. P (x) = a n x n + a n 1 x n a 1 x + a 0, a n 0
Polyomial Fuctios ad Models 1 Learig Objectives 1. Idetify polyomial fuctios ad their degree 2. Graph polyomial fuctios usig trasformatios 3. Idetify the real zeros of a polyomial fuctio ad their multiplicity
More informationData 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 informationData 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 informationCSE 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 informationWhat are we going to learn? CSC Data Structures Analysis of Algorithms. Overview. Algorithm, and Inputs
What are we goig to lear? CSC316-003 Data Structures Aalysis of Algorithms Computer Sciece North Carolia State Uiversity Need to say that some algorithms are better tha others Criteria for evaluatio Structure
More informationCS200: 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 informationXiaozhou (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 informationThe Adjacency Matrix and The nth Eigenvalue
Spectral Graph Theory Lecture 3 The Adjacecy Matrix ad The th Eigevalue Daiel A. Spielma September 5, 2012 3.1 About these otes These otes are ot ecessarily a accurate represetatio of what happeed i class.
More informationArithmetic 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 informationMassachusetts Institute of Technology Lecture : Theory of Parallel Systems Feb. 25, Lecture 6: List contraction, tree contraction, and
Massachusetts Istitute of Techology Lecture.89: Theory of Parallel Systems Feb. 5, 997 Professor Charles E. Leiserso Scribe: Guag-Ie Cheg Lecture : List cotractio, tree cotractio, ad symmetry breakig Work-eciet
More informationDesign 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 information5.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 informationAlpha Individual Solutions MAΘ National Convention 2013
Alpha Idividual Solutios MAΘ Natioal Covetio 0 Aswers:. D. A. C 4. D 5. C 6. B 7. A 8. C 9. D 0. B. B. A. D 4. C 5. A 6. C 7. B 8. A 9. A 0. C. E. B. D 4. C 5. A 6. D 7. B 8. C 9. D 0. B TB. 570 TB. 5
More informationOctahedral Graph Scaling
Octahedral Graph Scalig Peter Russell Jauary 1, 2015 Abstract There is presetly o strog iterpretatio for the otio of -vertex graph scalig. This paper presets a ew defiitio for the term i the cotext of
More informationCMSC Computer Architecture Lecture 12: Virtual Memory. Prof. Yanjing Li University of Chicago
CMSC 22200 Computer Architecture Lecture 12: Virtual Memory Prof. Yajig Li Uiversity of Chicago A System with Physical Memory Oly Examples: most Cray machies early PCs Memory early all embedded systems
More informationRunning 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 informationAnalysis 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 informationn 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 informationRecursive Procedures. How can you model the relationship between consecutive terms of a sequence?
6. Recursive Procedures I Sectio 6.1, you used fuctio otatio to write a explicit formula to determie the value of ay term i a Sometimes it is easier to calculate oe term i a sequece usig the previous terms.
More informationRecursion. Recursion. Mathematical induction: example. Recursion. The sum of the first n odd numbers is n 2 : Informal proof: Principle:
Recursio Recursio Jordi Cortadella Departmet of Computer Sciece Priciple: Reduce a complex problem ito a simpler istace of the same problem Recursio Itroductio to Programmig Dept. CS, UPC 2 Mathematical
More informationAn Efficient Algorithm for Graph Bisection of Triangularizations
A Efficiet Algorithm for Graph Bisectio of Triagularizatios Gerold Jäger Departmet of Computer Sciece Washigto Uiversity Campus Box 1045 Oe Brookigs Drive St. Louis, Missouri 63130-4899, USA jaegerg@cse.wustl.edu
More information3. b. Present a combinatorial argument that for all positive integers n : : 2 n
. b. Preset a combiatorial argumet that for all positive itegers : : Cosider two distict sets A ad B each of size. Sice they are distict, the cardiality of A B is. The umber of ways of choosig a pair of
More information9.1. Sequences and Series. Sequences. What you should learn. Why you should learn it. Definition of Sequence
_9.qxd // : AM Page Chapter 9 Sequeces, Series, ad Probability 9. Sequeces ad Series What you should lear Use sequece otatio to write the terms of sequeces. Use factorial otatio. Use summatio otatio to
More informationRunning 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 informationNumerical Methods Lecture 6 - Curve Fitting Techniques
Numerical Methods Lecture 6 - Curve Fittig Techiques Topics motivatio iterpolatio liear regressio higher order polyomial form expoetial form Curve fittig - motivatio For root fidig, we used a give fuctio
More informationAnalysis 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 informationData 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 informationChapter 8. Strings and Vectors. Copyright 2014 Pearson Addison-Wesley. All rights reserved.
Chapter 8 Strigs ad Vectors Overview 8.1 A Array Type for Strigs 8.2 The Stadard strig Class 8.3 Vectors Slide 8-3 8.1 A Array Type for Strigs A Array Type for Strigs C-strigs ca be used to represet strigs
More informationReliable 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 informationAnnouncements TREES II. Comparing Data Structures. Binary Search Trees. Red-Black Trees. Red-Black Trees 3/13/18
//8 Aoucemets Prelim is Toight, brig your studet ID :PM EXAM OLH: etids startig aa to dh OLH: etids startig di to ji PHL: etids startig jj to ks (Plus studets who switched from the 7: exam) TREES II Lecture
More informationChapter 10. Defining Classes. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 10 Defiig Classes Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 10.1 Structures 10.2 Classes 10.3 Abstract Data Types 10.4 Itroductio to Iheritace Copyright 2015 Pearso Educatio,
More informationECE4050 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 informationCounting Regions in the Plane and More 1
Coutig Regios i the Plae ad More 1 by Zvezdelia Stakova Berkeley Math Circle Itermediate I Group September 016 1. Overarchig Problem Problem 1 Regios i a Circle. The vertices of a polygos are arraged o
More informationCHAPTER IV: GRAPH THEORY. Section 1: Introduction to Graphs
CHAPTER IV: GRAPH THEORY Sectio : Itroductio to Graphs Sice this class is called Number-Theoretic ad Discrete Structures, it would be a crime to oly focus o umber theory regardless how woderful those topics
More informationOracle Server. What s New in this Release? Release Notes
Oracle email Server Release Notes Release 5.2 for Widows NT May 2001 Part No. A90426-01 These release otes accompay Oracle email Server Release 5.2 for Widows NT. They cotai the followig topics: What s
More information. 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 informationBOOLEAN MATHEMATICS: GENERAL THEORY
CHAPTER 3 BOOLEAN MATHEMATICS: GENERAL THEORY 3.1 ISOMORPHIC PROPERTIES The ame Boolea Arithmetic was chose because it was discovered that literal Boolea Algebra could have a isomorphic umerical aspect.
More informationUniversity 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 informationAn Efficient Algorithm for Graph Bisection of Triangularizations
Applied Mathematical Scieces, Vol. 1, 2007, o. 25, 1203-1215 A Efficiet Algorithm for Graph Bisectio of Triagularizatios Gerold Jäger Departmet of Computer Sciece Washigto Uiversity Campus Box 1045, Oe
More informationCivil Engineering Computation
Civil Egieerig Computatio Fidig Roots of No-Liear Equatios March 14, 1945 World War II The R.A.F. first operatioal use of the Grad Slam bomb, Bielefeld, Germay. Cotets 2 Root basics Excel solver Newto-Raphso
More informationquality/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 informationEE123 Digital Signal Processing
Last Time EE Digital Sigal Processig Lecture 7 Block Covolutio, Overlap ad Add, FFT Discrete Fourier Trasform Properties of the Liear covolutio through circular Today Liear covolutio with Overlap ad add
More informationA 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 informationCopyright 2016 Ramez Elmasri and Shamkant B. Navathe
Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe CHAPTER 18 Strategies for Query Processig Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe Itroductio DBMS techiques to process a query Scaer idetifies
More information