Chapter 6. Self-Adjusting Data Structures
|
|
- Alvin Cummings
- 5 years ago
- Views:
Transcription
1 Chapter 6 Self-Adjusting Data Structures Chapter 5 describes a data structure that is able to achieve an epected quer time that is proportional to the entrop of the quer distribution. The most interesting aspect of this data structure is that it does need to know the quer distribution in advance. Rather, the data structure adjusts itself using information gathered from previous queries. In this chapter we stud several other data structures that adjust themselves in the same wa. All of these data structures are ecient onl in an amortized sense. That is, individual operations take ma take a large amount of time, but over a sequence of man operations, the amortized (average) time per operation is still small. The advantage of self-organizing data structures is that the can often perform \natural" sequences of accesses much faster than their worst-case counterparts. Eamples of such natural sequences including accessing each of the elements in order, using the data structure like a stack or queue and performing man consecutive accesses to the same element. In other sections of this book we have analzed the amortized cost of operations on data structures using the accounting method, in which we manipulate credits to bound the amortized cost of operations. A dierent method of amortized analsis is the potential method. For an data structure D, we dene a potential Φ(D). If we let D i denote our data structure after the ith operation and let C i denote the cost (running time) of the ith operation then the amortized cost of the ith operation is dened as A i = C i + Φ(D i ) = Φ(D i 1 ). Note that this is simpl a denition and, since Φ is arbitrar, A i has nothing to do with the real cost 32
2 CHAPTER 6. SELF-ADJUSTING DATA STRUCTURES 33 C i. However, the the cost of a sequence of m operations is C i = (C i + Φ(D i ) Φ(D i 1 )) (Φ(D i ) Φ(D i 1 )) = = A i (Φ(D i ) Φ(D i 1 )) A i + Φ(D 0 ) Φ(D m ). The quantit Φ(D 0 ) Φ(D m ) is referred to as the net drop in potential. Thus, if we can provide a bound D on A i, then the total cost of m operations is md plus the net drop in potential. The potential method is equivalent to the accounting method. Anthing that can be proven with the potential method can be proven with the accounting method. (Just think of Φ(D) as the number of credits the data structure stores, with a negative value indicating that the data structure owes credits) However, once a potential function is dened, mathematical manipulations that can lead to ver compact proofs are convenient. Of course, the rub is in nding the right potential function. 6.1 Spla Trees One of the rst-ever self-modifing data structures is the spla tree. We begin our discussion of spla trees with the denition and analsis of the spla operation. A spla tree is a binar search tree that is augmented with the spla operation. Given a binar search tree T rooted at r and a node in T, splaing node is a sequence of left and right rotations performed on the tree until is the root of T. This sequence of rotations is governed b the following rules: (Note: a node is a left (respectivel, right) child if it is the left (respectivel, right) child of its parent) In what follows, is the parent of and z is the parent of (should it eist). 1. Zig step: If is the root of the tree, then rotate so that it becomes the root. 2. Zig Zig step: The node is not the root. Both and are left (or right) children, then rst rotate, so that z and are children of, then rotate so that it becomes the parent of. 3. Zig Zag step: Node is not the root. If is a right child and is a left child or vice-versa, rotate twice. After one rotation it is the parent of and after the second rotation, both and z are children of. We are now read to dene the potential of a spla tree. Let T be a binar search tree on n nodes and let the nodes be numbered from 1 to n. Assume that each node i has a ed positive weight w(i). Dene the size s() of a node to be the sum of the weights of all the nodes in the subtree rooted at, including the weight of. The rank r() of a node is log(s()). B denition, the rank of a node is at least as large as the rank of an of its decendants. The potential of a given tree T is Φ(T) = n log(s(i)). All of the properties of a spla tree are derived from the following lemma:
3 CHAPTER 6. SELF-ADJUSTING DATA STRUCTURES 34 zig z zig-zig z z zig-zag z Figure 6.1: Spla tree. Lemma 3. (Access Lemma) The amortized time to spla a binar search tree T with root t at a node is at most 3(r(t) r()) + 1 = O(log(s(t))/ log(s())) Proof. If node is the root, then the lemma holds triviall. If node is not the root, then a number of rotations are performed according to the rules of splaing. We rst show that the lemma holds after each step (zig, zigzig or zigzag) is performed. Let r 0 (i), r 1 (i) and s 0 (i), s 1 (i) represent the rank and size of node i before and after the rst step, respectivel. Recall that the amortized cost of an operation a = t + Φ 1 (T) Φ 0 (T) where t is the actual cost of the operation, and Φ 0 and Φ 1 are the potentials before and after the step. 1. Zig step: In this case, is the root of the tree and a single rotation is performed to make the root of the tree. In the whole spla operation, this step is onl ever eecuted once. The actual cost of the rotation is 1. We show that the amortized cost is at most 3(r 1 () r 0 ()) + 1. amortized cost = 1 + r 1 () + r 1 () r 0 () r 0 () (6.1) 1 + r 1 () r 0 () (6.2) 1 + 3(r 1 () r 0 ()) (6.3) Equation (6.1) follows from the denition of amortized cost and the fact that the onl ranks that changed are the ranks at and. The ranks of all other nodes in the tree remain the same since the nodes in their subtrees remain the same. Therefore, the change in potential is determined b the change in the ranks of and. Equation (6.2) holds because prior to the rotation, node was the root of the tree which implies that r 0 () r 1 (). Equation (6.3) follows since after the rotation, node is the root the tree, which means that r 1 () r 0 () is positive.
4 CHAPTER 6. SELF-ADJUSTING DATA STRUCTURES Zig Zig step: The node is not the root. Both and z are left (or right) children. In this case, two rotations are made. The rst rotation is at, so that z and are children of. The second rotation is at so that it becomes the parent of and grandparent of z. Since two rotations are performed, the actual cost of this step is 2. amortized cost = 2 + r 1 () + r 1 () + r 1 (z) r 0 () r 0 () r 0 (z) (6.4) = 2 + r 1 () + r 1 (z) r 0 () r 0 () (6.5) 2 + r 1 () + r 1 (z) 2r 0 ()) (6.6) After the two rotations, the onl ranks that change are the ranks of, and z. Therefore, the change in potential is dened b the change in their ranks. Equation (6.4) follows from the denition of amortized cost. Now, prior to the two rotations, is child of which is a child of z and after the two rotations, z is a child of which is a child of. This implies that r 1 () = r 0 (z). Equation (6.5) follows. Similarl, (6.6) follows since r 1 () r 1 () and r 0 () r 0 (). What remains to be shown is that 2 + r 1 () + r 1 (z) 2r 0 ()) 3(r 1 () r 0 ()). With a little manipulation, we see that this is equivalent to showing that r 1 (z)+r 0 () 2r 1 () 2. (6.7) r 1 (z) + r 0 () 2r 1 () = log(s 1 (z)/s 1 ()) + log(s 0 ()/s 1 ()) (6.8) = log((s 1 (z)/s 1 ()) (s 0 ()/s 1 ())) (6.9) log(1/4) (6.10) = 2 (6.11) Equation (6.8) simpl follows from the denition of ranks. Notice that s 1 () s 1 (z) + s 0 (). This implies that s 1 (z)/s 1 () + s 0 ()/s 1 () 1. If we let b = s 1 (z)/s 1 () and c = s 0 ()/s 1 (), we note that b + c 1 and the epression in (6.9) becomes log(bc). Elementar calculus shows that given b + c 1, the product bc is maimized when b = c = 1/2. This gives (6.10). 3. Zig Zag step: Node is not the root. If is a right child and is a left child or vice-versa, rotate twice. After one rotation it is the parent of and after the second rotation, both and z are children of. Again since two rotations are performed, the actual cost of the operation is 2. Let us look at what the amortized cost is. amortized cost = 2 + r 1 () + r 1 () + r 1 (z) r 0 () r 0 () r 0 (z) (6.12) = 2 + r 1 () + r 1 (z) r 0 () r 0 () (6.13) 2 + r 1 () + r 1 (z) 2r 0 ()) (6.14) (6.15) After the two rotations, the onl ranks that change are the ranks of, and z. Therefore, the change in potential is again dened b the change in their ranks. Equation (6.12) follows from the denition of amortized cost. Now, prior to the two rotations, z is the root of the subtree under consideration and after the two rotations, is the root. Therefore, we have r 1 () = r 0 (z). Equation (6.13) follows. Similarl, r 0 () r 0 () since is a child of prior to the rotations. What remains to be shown is that 2 + r 1 () + r 1 (z) 2r 0 ()) 3(r 1 () r 0 ()). This is equivalent showing that r 1 () + r 1 (z) + r 0 () 3r 1 () 2.
5 CHAPTER 6. SELF-ADJUSTING DATA STRUCTURES 36 r 1 () + r 1 (z) + r 0 () 3r 1 () = log((s 1 ()/s 1 ()) (s 1 (z)/s 1 ())) + r 0 () r 1 () (6.16) log(1/4) (6.17) = 2 (6.18) The argument is similar to the previous case. Equation (6.16) simpl follows from the denition of ranks and some manipulation of logs. The inequalit (6.17) follows because s 1 () s 1 () + s 1 (z) and r 0 () r 1 (). Now, suppose that a spla operation requires k > 1 steps. Onl the kth step will be a zig step and all the others will either be zigzig or zigzag steps. From the three cases shown above, the amortized cost of the whole spla operation is k 1 3r k () 3r k 1 () (3r j () 3r j 1 ()) = 3r k () 3r 0 () + 1. j=1 If each node is given a weight of 1, the above lemma suggests that the amortized cost of performing a spla operation is O(log n) where n is the size of the tree. However, Lemma 3 is surprisingl much more powerful. Notice that the weight of a node was never reall specied. We onl stated that it should be a positive constant. The power comes from the fact that the lemma holds for an assignment of positive weights to the nodes. B carefull choosing the weights, we can prove man interesting properties of spla trees. Let us look at some eamples, starting with the most mundane. Theorem 14 (Balance Theorem). Given a sequence of m accesses into an n node spla tree T, the total access time is O(n log n + m log n). Proof. Assign a weight of 1 to each node. The maimum value that s() can have for an node 2 T is n since the sum of the weights is n. The minimum value of s() is 1. Therefore, the amortized access cost for an element is at most 3(log(n) log(1)) + 1 = 3 log(n) + 1. The maimum potential Φ ma (T) that the tree can have is log(s(i)) log(n) = n log n The minimum potential Φ min (T) that the tree can have is log(s(i)) log(1) = 0. Therefore, the maimum drop in potential over the whole sequence is Φ ma (T) Φ min (T) = n log n. Thus, the total cost of accessing the sequence is O(m log n + n log n), as required. This means that starting from an initial binar search tree, if we access m > n kes, the cost per access will be O(log n). This is quite interesting since we can start with a ver unbalanced tree, such as an n-node path, and still achieve good behaviour. Net we prove something much more interesting.
6 CHAPTER 6. SELF-ADJUSTING DATA STRUCTURES 37 Theorem 15 (Static Optimalit Meta-Theorem). Fi some static binar search tree T and let d() denote the depth of the node containing in T. For an access sequence a 1,..., a m consisting of elements in T, the cost of accessing a 1,..., a m using a spla tree is at most O(n log n + m + m d(a i). Proof. If d() is the depth of node in T, then we assign a weight of w() = 1/n + 1/3 d() to the node containing in the spla tree. Now, note that the size of the root (and hence an node) is at most 1/n + 1/3 d() = 1 + 1/3 d() i /3 i = 4, 2T i=0 2T since T has at most 2 i nodes with depth j and these each have weight 1/3 j. Now, appling the Access Lemma, we nd that the amortized cost of accessing node is at most 3(log 4 log(s())) + 1 = 7 3 log(1/n + 1/3 d() ) 7 3 log(1/3 d() ) = log(3 d() ) = 7 + (3 log 3)d() All that remains is to bound the net drop in potential, Φ ma Φ min. We have alread determined that s() 4 for an node, so r() 2 and Φ ma 2n. On the other hand, s() w() 1/n for ever node, so r() log n and Φ min n log n. Putting everthing together, we get that the total cost of accessing a 1,..., a m using a spla tree is C(a 1,..., a m ) Φ ma Φ min + = 2n ( n log n) + (7 + (3 log 3)d(a i )) (7 + (3 log 3)d(a i )) = n log n + 2n + 7m + (3 log 3) = O n log n + m +! d(a i ) d(a i ). The Static Optimalit Meta-Theorem allows us to compare the performance of a spla tree with that of an ed binar search tree. For eample, letting T be a perfectl balanced binar search tree on n items so that d() log n for ever and appling the Static Optimalit Theorem gives the Balance Theorem. As another eample, in Chapter 5, we saw that when searches are drawn independentl from some distribution, then there eists a binar search tree whose epected search time is proportional to the entrop of that distribution. This implies the following corollar of the Static Optimalit Meta- Theorem:
7 CHAPTER 6. SELF-ADJUSTING DATA STRUCTURES 38 Corollar 1. (Static Optimalit Theorem) If a 1,..., a m are drawn from a set of size n, each independentl from the a probabilit distribution with entrop H, then the epected time to access a 1,..., a m using a spla tree is O(n log n + m + mh). As another eample, we obtain the static nger propert. As an eercise, show how, given an integer f 2 {1,..., n} to design a static tree that stores 1,..., n and such that the time to search for is O(1 + log f ). (Hint: Tr the special case f = 1 rst.) The eistence of this tree implies the following result: Corollar 2. (Static Finger Theorem) Let a 1,..., a m be a sequence of values in {1,..., n}. Then, for an f 2 {1,..., n}, the time to access a 1,..., a m using a spla tree is O(n log n+m+ m log a i f ). Of course, Corollar 2 is not reall restricted to trees that store {1,..., n}; these are just standins for the ranks of elements in an totall ordered set. We nish with one additional propert of spla trees that is not covered b the Static Optimalit Theorem: Theorem 16. (Working-Set Theorem) For an access sequence a 1,..., a m the cost of accessing a 1,..., a m using a spla tree is at most O(n log n + m + m log w i(a i )), where { min{j 1 : a i j = } if 2 {a 1,..., a i 1 } w i () = n otherwise. Proof. Assign the weights 1, 1/4, 1/9,..., 1/n 2 to the values in the spla tree in the order of their rst appearance in the sequence a 1,..., a m, so that w(a 1 ) = 1 and, if a 2 6= a 1, then w(a 2 ) = 1/4, and so on. Immediatel after an accessing and splaing an element a i, whose weight is 1/k 2, we will reweight some elements as follows: a i will be assigned weight 1, the item with weight 1 will be assigned weight 1/4, the item with weight 1/4 will be assigned weight 1/9 and, in general, an item with weight 1/j 2, j < k will be assigned weight 1/(j + 1) 2. Notice that, with this scheme, the sum of all the weights, and hence the size of the root is 1/i 2 1/i 2 = π 2 /6. (The second, innite, sum is the subject of the Basel Problem, rst solved b Euler in 1735; the solution can be found in most calculus tetbooks.) This initial assignment of weights along with the reassignment of weights ensures that the weight of a i at the time it is accessed is 1/(w i (a i )) 2. The Access Lemma then implies that the amortized cost to access a i is at most 3(log(π 2 /6) log(1/w i (a i ) 2 )) + 1 = 3(log(π 2 /6) + 2 log w i (a i )) + 1 This is all great, ecept that we also have to account for an increase in potential caused b the reweighting. The reweighting increases the weight of a i from 1/(w i (a i )) 2 to 1. For values other than a i, the weights onl decrease or remain unchanged. Since, b the time we do reweighting a i is at the root, the reweighting does not increase the rank of a i. On the other hand, it can onl decrease the ranks of other nodes, so overall it can not result in an increase in potential. To nish, we need onl bound Φ ma and Φ min. We alread have an upper bound of log(π 2 /6) on the rank of the root, which gives an upper bound of Φ ma n log(π 2 /6). For the lower-bound, note
8 CHAPTER 6. SELF-ADJUSTING DATA STRUCTURES 39 that ever node has weight at least 1/n 2, so it's rank is at least 2 log n and Φ min 2n log n. To summarize, the total cost of accessing a 1,..., a m is C(a 1,..., a m ) Φ ma Φ min + 3 log π 2 /6 + 2 log w i (a i ) = (π 2 /6)n + 2n log n + 3 log(π 2 /6)m + = O n log n + m +! log w i (a i ). 6 log w i (a i ) 6.2 Pairing Heaps John Iacono apparentl has a mapping between spla trees and pairing heaps that makes all the analses carr over. 6.3 Queaps Net, we consider an implementation of priorit queues. These are data structures that support the insertion of real-valued priorities. At an time, the data structure can return a pointer to a node storing the minimum priorit, and given a pointer to a node, that node (and it's corresponding priorit) can be deleted. For the data structure we describe, the cost to insert an element is O(1) and the cost to etract the element is O(log(q()), where q() denotes the number of elements that have been in the data structure longer than. Thus, if the priorit queue is used as a normal queue (the rst element inserted is the rst element deleted) then all operations take constant time. We sa that a data structure that has this propert is queueish. The data structure consists of a balanced tree T and a list L. Refer to Figure 6.3. The tree T is 2-4 tree, that is, all leaves of T are on the same level and each internal node of T has between 2 and 4 children. From this denition, it follows immediatel that the ith level of T contains at least 2 i nodes, so the height of T is logarithmic in the number of leaves. Another propert of 2-4 trees that is not immediatel obvious, but not dicult to prove, is that it is possible to insert and delete a leaf in O(1) amortized time. These insertions and deletions are done b splitting and merging nodes (see Figure 6.2), but an sequence of n insertions and deletions results onl in O(n) of these split and merge operations. It is important to note that T is not being used as a search tree. Rather, the leaves of T will store priorities so that the left to right order of the leaves is the same as the order in which the corresponding priorities were inserted. The nodes of T also contain some additional information. The left wall of T is the path from the root to the leftmost leaf. Each internal node v of T that is not part the left wall stores a pointer
Illinois Institute of Technology Department of Computer Science. Splay Trees. CS 535 Design and Analysis of Algorithms Fall Semester, 2018
Illinois Institute of Technolog epartment of omputer Science Spla Trees S 535 esign and nalsis of lgorithms Fall Semester, 2018 Spla trees are a powerful form of (leicographic) balanced binar trees devised
More informationChapter 6* The PPSZ Algorithm
Chapter 6* The PPSZ Algorithm In this chapter we present an improvement of the pp algorithm. As pp is called after its inventors, Paturi, Pudlak, and Zane [PPZ99], the improved version, pps, is called
More informationCSE 5311 Notes 5: Trees. (Last updated 6/4/13 4:12 PM)
SE 511 Notes 5: Trees (Last updated 6//1 :1 PM) What is the optimal wa to organie a static tree for searching? n optimal (static) binar search tree is significantl more complicated to construct than an
More information8. BOOLEAN ALGEBRAS x x
8. BOOLEAN ALGEBRAS 8.1. Definition of a Boolean Algebra There are man sstems of interest to computing scientists that have a common underling structure. It makes sense to describe such a mathematical
More information6.4 graphs OF logarithmic FUnCTIOnS
SECTION 6. graphs of logarithmic functions 9 9 learning ObjeCTIveS In this section, ou will: Identif the domain of a logarithmic function. Graph logarithmic functions. 6. graphs OF logarithmic FUnCTIOnS
More informationChapter 5 Data Structures Algorithm Theory WS 2017/18 Fabian Kuhn
Chapter 5 Data Structures Algorithm Theory WS 2017/18 Fabian Kuhn Priority Queue / Heap Stores (key,data) pairs (like dictionary) But, different set of operations: Initialize-Heap: creates new empty heap
More informationLecture 5: Splay Trees
15-750: Graduate Algorithms February 3, 2016 Lecture 5: Splay Trees Lecturer: Gary Miller Scribe: Jiayi Li, Tianyi Yang 1 Introduction Recall from previous lecture that balanced binary search trees (BST)
More informationSearch Trees. Chapter 10. CSE 2011 Prof. J. Elder Last Updated: :52 AM
Search Trees Chapter 1 < 6 2 > 1 4 = 8 9-1 - Outline Ø Binary Search Trees Ø AVL Trees Ø Splay Trees - 2 - Outline Ø Binary Search Trees Ø AVL Trees Ø Splay Trees - 3 - Binary Search Trees Ø A binary search
More informationpast balancing schemes require maintenance of balance info at all times, are aggresive use work of searches to pay for work of rebalancing
1 Splay Trees Sleator and Tarjan, Self Adjusting Binary Search Trees JACM 32(3) 1985 The claim planning ahead. But matches previous idea of being lazy, letting potential build up, using it to pay for expensive
More informationExponential and Logarithmic Functions
Eponential and Logarithmic Functions 6 Figure Electron micrograph of E. Coli bacteria (credit: Mattosaurus, Wikimedia Commons) CHAPTER OUTLINE 6. Eponential Functions 6. Logarithmic Properties 6. Graphs
More information5. Zeros. We deduce that the graph crosses the x-axis at the points x = 0, 1, 2 and 4, and nowhere else. And that s exactly what we see in the graph.
. Zeros Eample 1. At the right we have drawn the graph of the polnomial = ( 1) ( 2) ( 4). Argue that the form of the algebraic formula allows ou to see right awa where the graph is above the -ais, where
More information15. Eigenvalues, Eigenvectors
5 Eigenvalues, Eigenvectors Matri of a Linear Transformation Consider a linear ( transformation ) L : a b R 2 R 2 Suppose we know that L and L Then c d because of linearit, we can determine what L does
More informationSection 3.1. ; X = (0, 1]. (i) f : R R R, f (x, y) = x y
Paul J. Bruillard MATH 0.970 Problem Set 6 An Introduction to Abstract Mathematics R. Bond and W. Keane Section 3.1: 3b,c,e,i, 4bd, 6, 9, 15, 16, 18c,e, 19a, 0, 1b Section 3.: 1f,i, e, 6, 1e,f,h, 13e,
More informationINF2220: algorithms and data structures Series 1
Universitetet i Oslo Institutt for Informatikk I. Yu, D. Karabeg INF2220: algorithms and data structures Series 1 Topic Function growth & estimation of running time, trees (Exercises with hints for solution)
More informationCS Data Structures and Algorithm Analysis
CS 483 - Data Structures and Algorithm Analysis Lecture VII: Chapter 6, part 2 R. Paul Wiegand George Mason University, Department of Computer Science March 22, 2006 Outline 1 Balanced Trees 2 Heaps &
More informationWe have examined power functions like f (x) = x 2. Interchanging x
CHAPTER 5 Eponential and Logarithmic Functions We have eamined power functions like f =. Interchanging and ields a different function f =. This new function is radicall different from a power function
More informationFibonacci Heaps These lecture slides are adapted from CLRS, Chapter 20.
Fibonacci Heaps These lecture slides are adapted from CLRS, Chapter 20. Princeton University COS 4 Theory of Algorithms Spring 2002 Kevin Wayne Priority Queues Operation mae-heap insert find- delete- union
More informationChapter 18 Quadratic Function 2
Chapter 18 Quadratic Function Completed Square Form 1 Consider this special set of numbers - the square numbers or the set of perfect squares. 4 = = 9 = 3 = 16 = 4 = 5 = 5 = Numbers like 5, 11, 15 are
More informationLESSON #48 - INTEGER EXPONENTS COMMON CORE ALGEBRA II
LESSON #8 - INTEGER EXPONENTS COMMON CORE ALGEBRA II We just finished our review of linear functions. Linear functions are those that grow b equal differences for equal intervals. In this unit we will
More informationFlows and Connectivity
Chapter 4 Flows and Connectivit 4. Network Flows Capacit Networks A network N is a connected weighted loopless graph (G,w) with two specified vertices and, called the source and the sink, respectivel,
More informationLecture 2 14 February, 2007
6.851: Advanced Data Structures Spring 2007 Prof. Erik Demaine Lecture 2 14 February, 2007 Scribes: Christopher Moh, Aditya Rathnam 1 Overview In the last lecture we covered linked lists and some results
More informationSplay Trees. CMSC 420: Lecture 8
Splay Trees CMSC 420: Lecture 8 AVL Trees Nice Features: - Worst case O(log n) performance guarantee - Fairly simple to implement Problem though: - Have to maintain etra balance factor storage at each
More informationDictionary: an abstract data type
2-3 Trees 1 Dictionary: an abstract data type A container that maps keys to values Dictionary operations Insert Search Delete Several possible implementations Balanced search trees Hash tables 2 2-3 trees
More informationAVL trees. AVL trees
Dnamic set DT dnamic set DT is a structure tat stores a set of elements. Eac element as a (unique) ke and satellite data. Te structure supports te following operations. Searc(S, k) Return te element wose
More information5.6 RATIOnAl FUnCTIOnS. Using Arrow notation. learning ObjeCTIveS
CHAPTER PolNomiAl ANd rational functions learning ObjeCTIveS In this section, ou will: Use arrow notation. Solve applied problems involving rational functions. Find the domains of rational functions. Identif
More informationSearch Trees. EECS 2011 Prof. J. Elder Last Updated: 24 March 2015
Search Trees < 6 2 > 1 4 = 8 9-1 - Outline Ø Binary Search Trees Ø AVL Trees Ø Splay Trees - 2 - Learning Outcomes Ø From this lecture, you should be able to: q Define the properties of a binary search
More informationDictionary: an abstract data type
2-3 Trees 1 Dictionary: an abstract data type A container that maps keys to values Dictionary operations Insert Search Delete Several possible implementations Balanced search trees Hash tables 2 2-3 trees
More informationReview Topics for MATH 1400 Elements of Calculus Table of Contents
Math 1400 - Mano Table of Contents - Review - page 1 of 2 Review Topics for MATH 1400 Elements of Calculus Table of Contents MATH 1400 Elements of Calculus is one of the Marquette Core Courses for Mathematical
More informationLESSON #28 - POWER FUNCTIONS COMMON CORE ALGEBRA II
1 LESSON #8 - POWER FUNCTIONS COMMON CORE ALGEBRA II Before we start to analze polnomials of degree higher than two (quadratics), we first will look at ver simple functions known as power functions. The
More informationSection 1.2: A Catalog of Functions
Section 1.: A Catalog of Functions As we discussed in the last section, in the sciences, we often tr to find an equation which models some given phenomenon in the real world - for eample, temperature as
More informationFoundations of Databases
Foundations of Databases (Slides adapted from Thomas Eiter, Leonid Libkin and Werner Nutt) Foundations of Databases 1 Quer optimization: finding a good wa to evaluate a quer Queries are declarative, and
More informationPart III. Data Structures. Abstract Data Type. Dynamic Set Operations. Dynamic Set Operations
Abstract Data Type Part III Data Structures An abstract data type (ADT) is defined by an interface of operations or methods that can be performed and that have a defined behavior. The data types in this
More informationData Structures and Algorithms
Data Structures and Algorithms Spring 2017-2018 Outline 1 Sorting Algorithms (contd.) Outline Sorting Algorithms (contd.) 1 Sorting Algorithms (contd.) Analysis of Quicksort Time to sort array of length
More informationFACULTY OF MATHEMATICAL STUDIES MATHEMATICS FOR PART I ENGINEERING. Lectures AB = BA = I,
FACULTY OF MATHEMATICAL STUDIES MATHEMATICS FOR PART I ENGINEERING Lectures MODULE 7 MATRICES II Inverse of a matri Sstems of linear equations Solution of sets of linear equations elimination methods 4
More informationLESSON #24 - POWER FUNCTIONS COMMON CORE ALGEBRA II
1 LESSON #4 - POWER FUNCTIONS COMMON CORE ALGEBRA II Before we start to analze polnomials of degree higher than two (quadratics), we first will look at ver simple functions known as power functions. The
More informationx y plane is the plane in which the stresses act, yy xy xy Figure 3.5.1: non-zero stress components acting in the x y plane
3.5 Plane Stress This section is concerned with a special two-dimensional state of stress called plane stress. It is important for two reasons: () it arises in real components (particularl in thin components
More informationIntermediate Algebra. Gregg Waterman Oregon Institute of Technology
Intermediate Algebra Gregg Waterman Oregon Institute of Technolog c 2017 Gregg Waterman This work is licensed under the Creative Commons Attribution 4.0 International license. The essence of the license
More informationINTRODUCTION TO DIFFERENTIAL EQUATIONS
INTRODUCTION TO DIFFERENTIAL EQUATIONS. Definitions and Terminolog. Initial-Value Problems.3 Differential Equations as Mathematical Models CHAPTER IN REVIEW The words differential and equations certainl
More informationLecture VI AMORTIZATION
1. Potential Framework Lecture VI Page 1 Lecture VI AMORTIZATION Many algorithms amount to a sequence of operations on a data structure. For instance, the well-known heapsort algorithm is a sequence of
More information8.4. If we let x denote the number of gallons pumped, then the price y in dollars can $ $1.70 $ $1.70 $ $1.70 $ $1.
8.4 An Introduction to Functions: Linear Functions, Applications, and Models We often describe one quantit in terms of another; for eample, the growth of a plant is related to the amount of light it receives,
More information1. Introduction Bottom-Up-Heapsort is a variant of the classical Heapsort algorithm due to Williams ([Wi64]) and Floyd ([F64]) and was rst presented i
A Tight Lower Bound for the Worst Case of Bottom-Up-Heapsort 1 by Rudolf Fleischer 2 Keywords : heapsort, bottom-up-heapsort, tight lower bound ABSTRACT Bottom-Up-Heapsort is a variant of Heapsort. Its
More information1 Greedy Graph Algorithms
+//+ Algorithms & Data Structures (DL) Exam of 7 December 5 Instructions: This is a multiple-choice exam, to save ou the time of tiding up the presentation of our answers. There is exactl one correct answer
More informationSplay Trees Handout. Last time we discussed amortized analysis of data structures
Spla Tees Handout Amotied Analsis Last time we discussed amotied analsis of data stuctues A wa of epessing that even though the wost-case pefomance of an opeation can be bad, the total pefomance of a sequence
More information1 Introduction A priority queue is a data structure that maintains a set of elements and supports operations insert, decrease-key, and extract-min. Pr
Buckets, Heaps, Lists, and Monotone Priority Queues Boris V. Cherkassky Central Econ. and Math. Inst. Krasikova St. 32 117418, Moscow, Russia cher@cemi.msk.su Craig Silverstein y Computer Science Department
More information6. Linear transformations. Consider the function. f : R 2 R 2 which sends (x, y) (x, y)
Consider the function 6 Linear transformations f : R 2 R 2 which sends (x, ) (, x) This is an example of a linear transformation Before we get into the definition of a linear transformation, let s investigate
More informationLESSON #42 - INVERSES OF FUNCTIONS AND FUNCTION NOTATION PART 2 COMMON CORE ALGEBRA II
LESSON #4 - INVERSES OF FUNCTIONS AND FUNCTION NOTATION PART COMMON CORE ALGEBRA II You will recall from unit 1 that in order to find the inverse of a function, ou must switch and and solve for. Also,
More informationSolutions to Two Interesting Problems
Solutions to Two Interesting Problems Save the Lemming On each square of an n n chessboard is an arrow pointing to one of its eight neighbors (or off the board, if it s an edge square). However, arrows
More informationDerivatives of Multivariable Functions
Chapter 0 Derivatives of Multivariable Functions 0. Limits Motivating Questions In this section, we strive to understand the ideas generated b the following important questions: What do we mean b the limit
More informationOutline for Today. Static Optimality. Splay Trees. Properties of Splay Trees. Dynamic Optimality (ITA) Balanced BSTs aren't necessarily optimal!
Splay Trees Outline for Today Static Optimality alanced STs aren't necessarily optimal! Splay Trees self-adjusting binary search tree. Properties of Splay Trees Why is splaying worthwhile? ynamic Optimality
More informationTable of Contents. Module 1
Table of Contents Module 1 11 Order of Operations 16 Signed Numbers 1 Factorization of Integers 17 Further Signed Numbers 13 Fractions 18 Power Laws 14 Fractions and Decimals 19 Introduction to Algebra
More informationAmortized Complexity Main Idea
omp2711 S1 2006 Amortized Complexity Example 1 Amortized Complexity Main Idea Worst case analysis of run time complexity is often too pessimistic. Average case analysis may be difficult because (i) it
More information1.2 Functions and Their Properties PreCalculus
1. Functions and Their Properties PreCalculus 1. FUNCTIONS AND THEIR PROPERTIES Learning Targets for 1. 1. Determine whether a set of numbers or a graph is a function. Find the domain of a function given
More informationMA Game Theory 2005, LSE
MA. Game Theor, LSE Problem Set The problems in our third and final homework will serve two purposes. First, the will give ou practice in studing games with incomplete information. Second (unless indicated
More informationAmortized Analysis (chap. 17)
Amortized Analysis (chap. 17) Not just consider one operation, but a sequence of operations on a given data structure. Average cost over a sequence of operations. Probabilistic analysis: Average case running
More informationLimits and Continuous Functions. 2.2 Introduction to Limits. We first interpret limits loosely. We write. lim f(x) = L
2 Limits and Continuous Functions 2.2 Introduction to Limits We first interpret limits loosel. We write lim f() = L and sa the limit of f() as approaches c, equals L if we can make the values of f() arbitraril
More information= 1 2 x (x 1) + 1 {x} (1 {x}). [t] dt = 1 x (x 1) + O (1), [t] dt = 1 2 x2 + O (x), (where the error is not now zero when x is an integer.
Problem Sheet,. i) Draw the graphs for [] and {}. ii) Show that for α R, α+ α [t] dt = α and α+ α {t} dt =. Hint Split these integrals at the integer which must lie in any interval of length, such as [α,
More informationnm nm
The Quantum Mechanical Model of the Atom You have seen how Bohr s model of the atom eplains the emission spectrum of hdrogen. The emission spectra of other atoms, however, posed a problem. A mercur atom,
More information11.4 Polar Coordinates
11. Polar Coordinates 917 11. Polar Coordinates In Section 1.1, we introduced the Cartesian coordinates of a point in the plane as a means of assigning ordered pairs of numbers to points in the plane.
More information2 Generating Functions
2 Generating Functions In this part of the course, we re going to introduce algebraic methods for counting and proving combinatorial identities. This is often greatly advantageous over the method of finding
More informationCONTINUOUS SPATIAL DATA ANALYSIS
CONTINUOUS SPATIAL DATA ANALSIS 1. Overview of Spatial Stochastic Processes The ke difference between continuous spatial data and point patterns is that there is now assumed to be a meaningful value, s
More informationA STUDY ON SPLAY TREES
STUDY ON SPLY TREES LUÍS M. S. RUSSO bstract. We stud the dnamic optimalit conjecture, which predicts that spla trees are a form of universall efficient binar search tree, for an access sequence. We reduce
More informationHomework Notes Week 6
Homework Notes Week 6 Math 24 Spring 24 34#4b The sstem + 2 3 3 + 4 = 2 + 2 + 3 4 = 2 + 2 3 = is consistent To see this we put the matri 3 2 A b = 2 into reduced row echelon form Adding times the first
More information2: Distributions of Several Variables, Error Propagation
: Distributions of Several Variables, Error Propagation Distribution of several variables. variables The joint probabilit distribution function of two variables and can be genericall written f(, with the
More informationENS Lyon Camp. Day 2. Basic group. Cartesian Tree. 26 October
ENS Lyon Camp. Day 2. Basic group. Cartesian Tree. 26 October Contents 1 Cartesian Tree. Definition. 1 2 Cartesian Tree. Construction 1 3 Cartesian Tree. Operations. 2 3.1 Split............................................
More informationSection J Venn diagrams
Section J Venn diagrams A Venn diagram is a wa of using regions to represent sets. If the overlap it means that there are some items in both sets. Worked eample J. Draw a Venn diagram representing the
More information11.1 Double Riemann Sums and Double Integrals over Rectangles
Chapter 11 Multiple Integrals 11.1 ouble Riemann Sums and ouble Integrals over Rectangles Motivating Questions In this section, we strive to understand the ideas generated b the following important questions:
More informationWorksheet #1. A little review.
Worksheet #1. A little review. I. Set up BUT DO NOT EVALUATE definite integrals for each of the following. 1. The area between the curves = 1 and = 3. Solution. The first thing we should ask ourselves
More information74 Maths Quest 10 for Victoria
Linear graphs Maria is working in the kitchen making some high energ biscuits using peanuts and chocolate chips. She wants to make less than g of biscuits but wants the biscuits to contain at least 8 g
More informationIntroduction to Vector Spaces Linear Algebra, Spring 2011
Introduction to Vector Spaces Linear Algebra, Spring 2011 You probabl have heard the word vector before, perhaps in the contet of Calculus III or phsics. You probabl think of a vector like this: 5 3 or
More informationLecture 7: Advanced Coupling & Mixing Time via Eigenvalues
Counting and Sampling Fall 07 Lecture 7: Advanced Coupling & Miing Time via Eigenvalues Lecturer: Shaan Oveis Gharan October 8 Disclaimer: These notes have not been subjected to the usual scrutin reserved
More informationMulti-Objective Weighted Sampling
1 Multi-Objective Weighted Sampling Edith Cohen Google Research Mountain View, CA, USA edith@cohenwangcom arxiv:150907445v6 [csdb] 13 Jun 2017 Abstract Multi-objective samples are powerful and versatile
More informationCHAPTER 2: Partial Derivatives. 2.2 Increments and Differential
CHAPTER : Partial Derivatives.1 Definition of a Partial Derivative. Increments and Differential.3 Chain Rules.4 Local Etrema.5 Absolute Etrema 1 Chapter : Partial Derivatives.1 Definition of a Partial
More informationStudy Guide and Intervention
6- NAME DATE PERID Stud Guide and Intervention Graphing Quadratic Functions Graph Quadratic Functions Quadratic Function A function defined b an equation of the form f () a b c, where a 0 b Graph of a
More informationDefinition: div Let n, d 0. We define ndiv d as the least integer quotient obtained when n is divided by d. That is if
Section 5. Congruence Arithmetic A number of computer languages have built-in functions that compute the quotient and remainder of division. Definition: div Let n, d 0. We define ndiv d as the least integer
More informationSplay trees (Sleator, Tarjan 1983)
Splay trees (Sleator, Tarjan 1983) 1 Main idea Try to arrange so frequently used items are near the root We shall assume that there is an item in every node including internal nodes. We can change this
More informationAssignment 5: Solutions
Comp 21: Algorithms and Data Structures Assignment : Solutions 1. Heaps. (a) First we remove the minimum key 1 (which we know is located at the root of the heap). We then replace it by the key in the position
More information2.1 Rates of Change and Limits AP Calculus
.1 Rates of Change and Limits AP Calculus.1 RATES OF CHANGE AND LIMITS Limits Limits are what separate Calculus from pre calculus. Using a it is also the foundational principle behind the two most important
More information2.1 Rates of Change and Limits AP Calculus
. Rates of Change and Limits AP Calculus. RATES OF CHANGE AND LIMITS Limits Limits are what separate Calculus from pre calculus. Using a it is also the foundational principle behind the two most important
More informationMAE 323: Chapter 4. Plane Stress and Plane Strain. The Stress Equilibrium Equation
The Stress Equilibrium Equation As we mentioned in Chapter 2, using the Galerkin formulation and a choice of shape functions, we can derive a discretized form of most differential equations. In Structural
More informationLines and Planes 1. x(t) = at + b y(t) = ct + d
1 Lines in the Plane Lines and Planes 1 Ever line of points L in R 2 can be epressed as the solution set for an equation of the form A + B = C. Will we call this the ABC form. Recall that the slope-intercept
More informationSection 4.1 Increasing and Decreasing Functions
Section.1 Increasing and Decreasing Functions The graph of the quadratic function f 1 is a parabola. If we imagine a particle moving along this parabola from left to right, we can see that, while the -coordinates
More informationEigenvectors and Eigenvalues 1
Ma 2015 page 1 Eigenvectors and Eigenvalues 1 In this handout, we will eplore eigenvectors and eigenvalues. We will begin with an eploration, then provide some direct eplanation and worked eamples, and
More informationBUYS Workbook. Preparing to come to Durham. Instructions
BUYS Workbook Preparing to come to Durham Instructions There are two steps we ask ou to take before ou arrive at Durham in October: STEP : Attempt the practice questions in this workbook. The questions
More informationLanguage and Statistics II
Language and Statistics II Lecture 19: EM for Models of Structure Noah Smith Epectation-Maimization E step: i,, q i # p r $ t = p r i % ' $ t i, p r $ t i,' soft assignment or voting M step: r t +1 # argma
More informationarxiv: v2 [math.co] 21 Apr 2012
INTERVALS OF BALANCED BINARY TREES IN THE TAMARI LATTICE arxiv:117.3472v2 [math.co] 21 Apr 212 SAMUELE GIRAUDO Abstract. We show that the set of balanced binar trees is closed b interval in the Tamari
More informationPriority queues implemented via heaps
Priority queues implemented via heaps Comp Sci 1575 Data s Outline 1 2 3 Outline 1 2 3 Priority queue: most important first Recall: queue is FIFO A normal queue data structure will not implement a priority
More informationRe(z) = a, For example, 3 + 2i = = 13. The complex conjugate (or simply conjugate") of z = a + bi is the number z defined by
F COMPLEX NUMBERS In this appendi, we review the basic properties of comple numbers. A comple number is a number z of the form z = a + bi where a,b are real numbers and i represents a number whose square
More informationPolynomial and Rational Functions
Polnomial and Rational Functions Figure -mm film, once the standard for capturing photographic images, has been made largel obsolete b digital photograph. (credit film : modification of work b Horia Varlan;
More informationThe Maze Generation Problem is NP-complete
The Mae Generation Problem is NP-complete Mario Alviano Department of Mathematics, Universit of Calabria, 87030 Rende (CS), Ital alviano@mat.unical.it Abstract. The Mae Generation problem has been presented
More informationChapter 4 Analytic Trigonometry
Analtic Trigonometr Chapter Analtic Trigonometr Inverse Trigonometric Functions The trigonometric functions act as an operator on the variable (angle, resulting in an output value Suppose this process
More informationCS361 Homework #3 Solutions
CS6 Homework # Solutions. Suppose I have a hash table with 5 locations. I would like to know how many items I can store in it before it becomes fairly likely that I have a collision, i.e., that two items
More information4 Inverse function theorem
Tel Aviv Universit, 2013/14 Analsis-III,IV 53 4 Inverse function theorem 4a What is the problem................ 53 4b Simple observations before the theorem..... 54 4c The theorem.....................
More information1.7 Inverse Functions
71_0107.qd 1/7/0 10: AM Page 17 Section 1.7 Inverse Functions 17 1.7 Inverse Functions Inverse Functions Recall from Section 1. that a function can be represented b a set of ordered pairs. For instance,
More information2.5 CONTINUITY. a x. Notice that Definition l implicitly requires three things if f is continuous at a:
SECTION.5 CONTINUITY 9.5 CONTINUITY We noticed in Section.3 that the it of a function as approaches a can often be found simpl b calculating the value of the function at a. Functions with this propert
More informationConsider a slender rod, fixed at one end and stretched, as illustrated in Fig ; the original position of the rod is shown dotted.
4.1 Strain If an object is placed on a table and then the table is moved, each material particle moves in space. The particles undergo a displacement. The particles have moved in space as a rigid bod.
More informationCSE 546 Midterm Exam, Fall 2014
CSE 546 Midterm Eam, Fall 2014 1. Personal info: Name: UW NetID: Student ID: 2. There should be 14 numbered pages in this eam (including this cover sheet). 3. You can use an material ou brought: an book,
More information8: Splay Trees. Move-to-Front Heuristic. Splaying. Splay(12) CSE326 Spring April 16, Search for Pebbles: Move found item to front of list
: Splay Trees SE Spring 00 pril, 00 Move-to-Front Heuristic Search for ebbles: Fred Wilma ebbles ino Fred Wilma ino ebbles Move found item to front of list Frequently searched items will move to start
More informationTrusses - Method of Sections
Trusses - Method of Sections ME 202 Methods of Truss Analsis Method of joints (previous notes) Method of sections (these notes) 2 MOS - Concepts Separate the structure into two parts (sections) b cutting
More information1.5. Analyzing Graphs of Functions. The Graph of a Function. What you should learn. Why you should learn it. 54 Chapter 1 Functions and Their Graphs
0_005.qd /7/05 8: AM Page 5 5 Chapter Functions and Their Graphs.5 Analzing Graphs of Functions What ou should learn Use the Vertical Line Test for functions. Find the zeros of functions. Determine intervals
More informationThe American School of Marrakesh. Algebra 2 Algebra 2 Summer Preparation Packet
The American School of Marrakesh Algebra Algebra Summer Preparation Packet Summer 016 Algebra Summer Preparation Packet This summer packet contains eciting math problems designed to ensure our readiness
More information