Optimum Alphabetic Binary Trees T. C. Hu and J. D. Morgenthaler Department of Computer Science and Engineering, School of Engineering, University of C

Size: px
Start display at page:

Download "Optimum Alphabetic Binary Trees T. C. Hu and J. D. Morgenthaler Department of Computer Science and Engineering, School of Engineering, University of C"

Transcription

1 Optimum Alphabetic Binary Trees T. C. Hu and J. D. Morgenthaler Department of Computer Science and Engineering, School of Engineering, University of California, San Diego CA 92093{0114, USA Abstract. We describe a modication of the Hu{Tucker algorithm for constructing an optimal alphabetic tree that runs in O(n) time for several classes of inputs. These classes can be described in simple terms and can be detected in linear time. We also give simple conditions and a linear algorithm for determining, in some cases, if two adjacent nodes will be combined in the optimal alphabetic tree. 1 Introduction Binary trees and binary codes have many applications in various branches of science and engineering, and the subjects have been studied extensively for more than forty years. In 1952, Human [] discovered the algorithm for constructing an optimum variable-length binary code or the binary tree with minimum weighted path length known as the Human's tree. In 1959, Gilbert and Moore [3] considered an alphabetic constraint which restricts the ordering of leaves in the binary tree and they found an algorithm for constructing an optimum alphabetic binary tree in O(n 3 ) time. Their technique is based on dynamic programming and is illustrated in many computer science textbooks. In 191, their solution technique was rened to O(n 2 ) time by Knuth [9], and a new algorithm was discovered by Hu and Tucker [6] which needs O(n log n) time and O(n) space. The implementation of the Hu-Tucker algorithm in O(n log n) time was pointed out by Knuth [10], and several improvements over the original algorithm was reported in Hu [4]. A similar algorithm was discovered by Garsia and Wachs in 19 [2]. But the time complexity remained at O(n log n). The applicability of Human's algorithm and the Hu-Tucker algorithm were generalized to other cost functions in [5]. Recently, the equivalence of alphabetic binary search tree and alphabetic binary code is noted by [1, 13]. Actually, Human's algorithm can be implemented in linear time if the weights of leaves are already sorted as noted by Larmore [12]. Also, testing the optimality of a given alphabetic binary tree is shown to be linear in several cases by Ramanan [15]. Thus, the search for a new linear algorithm for constructing an optimum alphabetic binary tree seems to be a natural one. Recently Klawe and Mumsy [8] and Przytycka and Larmore [14] have both obtained algorithms that run in less than O(n log n) time for special cases of weight sequences. Here we basically achieve the same results without introducing as much new terminology. Also, we have found simple conditions for two adjacent nodes to be combined in the optimal alphabetic tree which can be detected in O(n) time.

2 2 Problem and Known Results We use the denitions in Knuth [10] and consider an extended binary tree where every internal node has two children and every leaf has no children. The internal node is represented by a circle and the leaf by a square. The root of the extended binary tree (binary tree for brevity from now on) is said to be at the level zero, and its two children at the level one. Given a sequence of n leaves with positive weights w i, the problem is to construct an alphabetic binary tree with min P w i l i where l i is the level of the leaf with weight w i, and the ordering of leaves in the sequence is to be maintained. Due to the alphabetic constraint, a square node (a leaf) can only be combined with its left or right neighboring square, or a circular node whose descendants are a subsequence of squares next to the given square. Two circular nodes can be combined only if they are both roots of subtrees with leaves from two adjacent subsequences. A related problem is to nd the min-cost forest built on a sequence of positiveweight leaves where the forest has exactly k circles. (The alphabetic tree is a special case with k = n? 1.) We shall use w i to denote the node with weight w i or the node itself. Also, w ij to denote the parent of w i and w j with its weight w i + w j. The parent will occupy the position of the left child. A node w bc is said to be crossed over by another node w ad if one of the children of w bc is between the children of w ad. Two nodes in a sequence are called a compatible pair if they are adjacent in the sequence or if all nodes between them are circular nodes. Among all compatible pairs in a weight sequence, the one with minimum weight is called the minimum compatible pair (mcp). To break the ties among weights, we shall adopt the convention that the node on the left has smaller weight. A pair of nodes (w b ; w c ) is a local minimum compatible pair (lmcp) if w a > w c for all nodes w a compatible with w b w b w d for all nodes w d compatible with w c Hu-Tucker algorithms can be described in three steps: 1. Combination. Keep combining lmcp until a tree T is obtained. 2. Level Assignment. Find the level number of every leaf in tree T, say l 1 ; l 2 ; : : : ; l n. 3. Reconstruction. Use a stack algorithm to construct an alphabetic binary tree based on l 1 ; l 2 ; : : : ; l n. Note that both steps 2 and 3 take linear time while step 1 takes O(n log n) time. A weight sequence is called an increasing sequence if A decreasing sequence if w 1 w 2 : : : w n w 1 > w 2 > : : : > w n

3 A valley sequence if A bimonotonal increasing sequence if w 1 > w 2 > : : : > w i w i+1 : : : w n w 1 + w 2 w 2 + w 3 w 3 + w 4 : : : w n?1 + w n A bimonotonal decreasing sequence if w 1 + w 2 > w 2 + w 3 > w 3 + w 4 > : : : > w n?1 + w n A bimonotonal valley if it contains a single lmcp. Lemma 1. Let w a be an arbitrary node in a weight sequence consisting of circles and squares, and w i be the smallest node compatible to w a. If any lmcp is combined in the weight sequence and w d becomes compatible with w a, then w i w d. In other words, the smallest node compatible to any node w a will always remain the same. In particular, an lmcp in a weight sequence will remain as other lmcp are successively combined. Proof. See Hu [4]. Lemma 2. If in a weight sequence : : : w a ; w b ; w c ; w d ; : : : where w bc is crossed over by w cd in the construction of T, then l bc l ad, i.e., the four nodes are either at the same level or the two nodes w b and w c are at lower levels than w a and w d. Proof. See Hu [4]. 3 Summary of Key Observations We show that for weight sequences in several classes, the optimum alphabetic binary tree can be computed in linear time. We present these classes from the simplest to the most complicated. A binary tree is called a complete binary tree where all its leaves are at the same level or two adjacent levels. Obviously, if all leaves are of the same weight in a weight sequence and n = 2 k, then the optimum alphabetic binary tree is a complete binary tree with all leaves at the same level. If 2 k < n < 2 k+1, then all the leaves will be at two adjacent levels with 2(n? 2 k ) leaves at the lower level and (2 k+1? n) leaves at the higher level. Our rst observation is that for n leaves of almost the same weight, the optimum alphabetic binary tree is again a tree whose leaves are at two adjacent levels. We call such a weight sequence an almost uniform sequence. (Precise denition to be given later in Section 4.) In addition, given a sequence of n nodes of almost uniform weight (circle or square), with n = 2 k, the optimum alphabetic tree is again a complete binary tree where these circles and squares occupy a single level.

4 The second observation is that if the n leaves form an increasing sequence, we can perform the combination phase of the Hu-Tucker algorithm in linear time by queuing the circular nodes as they are created. Compatible circular nodes are placed at the end of a sorted queue as they are formed. Only the bottom two nodes of this queue need to be examined to determine the next lmcp. This is essentially the same modication reported by Larmore [12] that allows Human's algorithm to run in linear time on a sorted sequence. We can also perform the combination phase for a bimonotonal increasing sequence in linear time, since the bimonotonal condition guarantees that the leftmost square node will always be smaller than the node two to the right. Finally, a bimonotonal valley sequence consisting of a bimonotonal decreasing sequence followed by a bimonotonal increasing sequence is still linear, since we are guaranteed a single queue of circular nodes by the presence of a single initial lmcp. Figure 1 shows the operation of the modied combination phase on a bimonotonal valley sequence. At each combination in Fig. 1, the lmcp is found among the six nodes consisting of: the bottom two circular nodes in the queue, the two square nodes to the left of the queue, or the two square nodes to the right of the queue. For example, after the nal step shown in Fig. 1, the next lmcp cannot include the circular nodes with weights 11 or 13 due to construction of the queue. Thus, determining which nodes to combine at each step requires only constant time for a bimonotonal valley sequence. Any weight sequence can be broken into a set of bimonotonal valley sequences in linear time. The only thing that prevents the modied algorithm from running in linear time for an arbitrary weight sequence is the need to \merge" two queues when the mountaintop (dened in Section 4) between their valleys combines. Each merge requires linear time, but as O(n) queues could be merged at one time, the merging may require O(n log n) time. In the next section, we describe a class of initial weight sequences that do not require O(n) queues to be merged, and thus require only linear time for construction of their optimum alphabetic binary tree. 4 Linear Classes of Weight Sequences The previous section gave a modication of the Hu-Tucker algorithm that runs in linear time for a bimonotonal valley sequence. By restricting the number of queues of circular nodes that need to be merged at one time, the algorithm also runs in linear time for a larger class of initial sequences. When two valleys are adjacent, the point at which the bimonotone sequence changes from increasing to decreasing is called the mountaintop. This concept is the dual of lmcp, and could be called the locally maximum compatible pair. More formally: Denition 3. A mountaintop is the point between the two adjacent square nodes whose combined weight is locally the greatest. The weight of the mountaintop is the greater weight of these two nodes.

5 Fig. 1. First seven steps in the combination phase for the initial bimonotonal valley sequence, 3, 4, 1, 3, 2, 4, 3, 5, 3, 6

6 Adjacent mountaintops are the closest mountaintop on either the left or right of a node. If we extend the initial sequence by adding two special nodes of innite weight, one at each end, then every node, circular or square, has two adjacent mountaintops (except these two new innite weight nodes). A mountaintop combines (forming circular nodes) when both square nodes have combined. It is at the point in the algorithm when a mountaintop combines that queues of circular nodes are merged. Clearly, if the number of valleys in the weight sequence is bounded by a constant k, the modied Hu-Tucker algorithm runs in O(n log k) = O(n) time. We may be required to merge all k queues at once if the k? 1 mountaintops have the same weight. An interesting property of a queue of circular nodes is that they are all almost uniform. We can use this property to broaden the class of sequences where Hu- Tucker runs in linear time. Denition 4. A set of nodes is almost uniform if any two nodes have combined weight greater than or equal to any weight in the set. Node set W is almost uniform if and only if 8w 1 ; w 2 ; w 3 2 W; w 1 + w 2 w 3 Lemma 5. A set of compatible circular nodes created during phase I of the Hu- Tucker algorithm is almost uniform. Proof. Assume that the two smallest weight circular nodes sum to a total weight less than the weight of the largest circular node. Then the largest node was not created from an lmcp, since the two smallest weight nodes are locally minimum, contrary to the Hu-Tucker algorithm. The queues of two adjacent valleys combine when the largest square node (w T ) adjacent to their common mountaintop combines. When w T combines, a new circular node with weight greater than that of the last node in either queue is formed. In fact, the largest circular node on either queue (w c ) must have weight less than or equal to twice the weight of the mountaintop. w c 2w T Let the children of w c be w x and w y. Then by the fact that w T has not yet combined and the denition of mountaintop, w x w T and w y w T. After w T combines, all circular nodes in the two queues will have weight at least w T. It is well known that an optimum alphabetic binary tree can be created in linear time from a valley sequence. Now, let us consider two adjacent valley sequences with three mountaintops, e.g. w L > w 1 > > w i < < w T > w j > > w k < < w R Then, a queue of circular nodes will be created in linear time in the valley between w L and w T and similarly a queue of circular nodes will be created in the valley between w T and w R.

7 If w L and w R are both much larger than w T, then w T is combined into a circular node rst. And we will have two queues of circular nodes between w L and w R, with the parent of w T being the largest circular node. When this happens, the next combination is the smallest node in one queue with the smallest node in the other queue (or possibly with the second smallest node in its own queue). In other words, each combination takes constant time inside the valley bounded by the two mountaintops w L and w R. Eectively, we have a single valley, if w T min(w L =2; w R =2). If we have k adjacent valleys between w L and w R, then we may have k queues of circular nodes. To nd the next combination, we can select the two smallest nodes among the front elements in the k queues, say 1 and 1 (with 1 < 1 ) and then compare the next node in the queue ( 2 ) with 1 to determine min( ; ). In other words, as long as k is constant and is not a function of n, we can successively combine nodes in linear time. We say that the k valleys are nested inside the big valley w L and w R if the largest mountaintop among the inside mountaintops is less than half min(w L ; w R ). Of course, all the comments about valley sequences apply equally to bimonotonal valley sequences. Denition 6. Two valleys v 1 and v 2 are nested inside a larger valley V with mountaintops of weight w L and w R if the mountaintop separating v 1 and v 2 has weight w min(w L ; w R )=2. Denition. A proper valley has no nested valleys. A k-proper valley has at most k nested valleys, either proper valleys or k-proper valleys. Dened recursively, a k-proper valley is either: 1. a proper valley 2. a valley with at most k nested adjacent proper valleys 3. a valley with at most k nested adjacent k-proper valleys We now expand the class of weight sequences for which the modied Hu- Tucker algorithm requires only linear time to the set of all k-proper valleys. Theorem 8. The optimum alphabetic binary tree for an initial weight sequence W of n nodes that forms a k-proper valley can be computed in O(n) time for any constant k. Further, we can determine whether a sequence is a k-proper valley is O(n) time. Proof. We consider each case separately. Case 1: W is a proper valley. Since it has no nested valleys, W consists of a single bimonotonal valley, with a single lmcp. At each step in the combination phase, only one lmcp exists. When newly created circular nodes are placed in a queue, only six nodes (four square, two circular) could participate in that lmcp. Thus, each combination requires constant time, and the entire combination phase requires O(n) time. As the remaining phases are also linear, the entire tree is constructed in linear time.

8 Case 2: W is a valley with at most k nested adjacent proper valleys. Each nested proper valley requires linear time to combine all contained square nodes. When a mountaintop is combined, the adjacent compatible queues are merged. This requires at most k merges, each needing at most O(n) comparisons. Once all queues have been merged, this case resembles Case 1. Case 3: W is a valley with at most k nested adjacent k-proper valleys. Recursively, each nested k-proper valley can be handled in time linear in its size. Again, combining adjacent valleys by merging queues of circular nodes is linear, and must only be done k times. 4.1 Permanent Circular Nodes During the construction of an optimum k-circle forest, a given circle in the (k?1) circle forest may be split up in the optimum k-circle forest. For example, consider the initial sequence 4, 2, 3, 4. The optimum 1-circle forest combines the nodes weighing 2 and 3; these are not combined in the 2-circle or 3-circle forests. Would there exist a circle which will never be split up once it is formed? We shall call such a circle a permanent circular node (a permanent node). When we can detect such a circular node, then the circular node can be treated as a single square node in the weight sequence during later combinations. Lemma 9 Gilbert & Moore. Let w a ; w 1 ; w 2 ; : : : ; w k ; w d be a weight sequence where kx i=1 w i min(w a ; w d ) then the subsequence w 1 ; w 2 ; : : : ; w k will form a binary tree whose root is a permanent node. Proof. See [3]. Lemma 10. Let w a ; w b ; w c ; w d be any consecutive four nodes in a sequence and 1. w a > w c 2. w b w d 3. (w b + w c ) < max(w a ; w d ) Then the parent of w b and w c is a permanent node. Proof. Conditions 1 and 2 imply that w b and w c are a local minimum compatible pair. Without loss of generality, assume that w a > w d. Once w bc is formed as a circular node, both w a and w bc are compatible with w d and w a > w bc. Thus, w d combines with w bc before combining with w a. If w a should be combined with another node to its left, there cannot be a new node with its weight smaller than w bc which would be compatible with w d, by lemma 1. If w d should be combined with another node to its right, that circular node would also be compatible with w a and w bc.

9 Thus, the node w d or its ancestor will never cross over w bc to combine with w a or its ancestor. Node w bc will combine with a node adjacent to itself, and will not be crossed over. In other words, w bc is a permanent node. To show the power of identifying permanent nodes, consider the following weight sequence. 1; 2; 3; 4; 2; 1; 8; 10; 1 Here w a = 1, w b = 2, w c = 3, w d = 4, and we shall show it as After 2 and 3 are combined into 5, we move forward until the condition of permanent node is again satised And then move backward (after = 3) Another example is And at this stage, the sequence is almost uniform and no more permanent nodes can be created. Lemma 11. We can identify and combine all permanent nodes in O(n) time. Proof. In a scan from left to right of the initial weight sequence, at each node B, label its neighbors A B C D and do the following: If A > C, B D and B + C < max(a; D) replace nodes B and C with new square node B + C and back up to consider node A again, else do nothing. If the node has no left neighbor or less than two right neighbors, do nothing. At each step, the number of nodes to the right of the node being considered either decreases by one (do nothing case), or remains unchanged. If it remains unchanged, the number of nodes to the left decreases by one. Thus, we can perform at most 2n total steps before the scan terminates. Since permanent nodes can be found and combined in linear time, we can expand our class of weight sequences with optimum alphabetic trees computable in linear time to any sequence which after nding and combining permanent nodes is a k-proper valley.

10 5 Conclusion We have shown that a modication of the Hu{Tucker algorithm will run in linear time for many classes on input sequences. By scanning a given input sequence for mountaintops and counting adjacent groups of almost uniform mountaintops, membership in such a class can also be determined in linear time. We have also given a linear algorithm for nding and combining permanent circular nodes detectable on the initial sequence in a four node moving window. References 1. Arne Andersson. A note on searching in a binary search tree. Software{Practice and Experience, 21(10):1125{1128, A. M. Garsia and M. L. Wachs. A new algorithm for minimum cost binary trees. SIAM Journal on Computing, 6(4):622{642, E. N. Gilbert and E. F. Moore. Variable length binary encodings. Bell System Technical Journal, 38:933{968, T. C. Hu. Combinatorial Algorithms. Addison-Wesley, Reading, MA, T. C. Hu, D. J. Kleitman, and J. K. Tamaki. Binary trees optimum under various criteria. SIAM Journal on Applied Mathematics, 3(2):246{256, T. C. Hu and A. C. Tucker. Optimal computer search trees and variable-length alphabetic codes. SIAM Journal on Applied Mathematics, 21(4):514{532, D. A. Human. A method for the construction of minimum redundancy codes. Proceedings of the IRE, 40:1098{1101, M. M. Klawe and B. Mumey. Upper and lower bounds on constructing alphabetic binary trees. In Proceedings of Fourth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 185{193, D. E. Knuth. Optimum binary search trees. Acta Informatica, 1:14{25, D. E. Knuth. The Art of Computer Programming, Volume III: Sorting and Searching. Addison-Wesley, Reading, MA, L. L. Larmore. A subquadratic algorithm for constructing approximately optimal binary search trees. Journal of Algorithms, 8(4):59{591, L. L. Larmore. Height restricted optimal binary trees. SIAM Journal on Computing, 16(6):1115{1123, N. Nakatsu. An alphabetic code and its application to information retrieval. Transactions of the Information Processing Society of Japan, 34(2):312{19, T.M. Przytycka and L.L. Larmore. The optimal alphabetic tree problem revisited. In Proceedings of 21st International Colloquium on Automata, Languages, and Programming, pages 251{262. Springer-Verlag, July P. Ramanan. Testing the optimality of alphabetic trees. Theoretical Computer Science, 93(2):29{301, This article was processed using the LATEX macro package with LLNCS style

Building Optimal Alphabetic Trees Recursively

Building Optimal Alphabetic Trees Recursively Building Optimal Alphabetic Trees Recursively Ahmed A Belal 1, Mohamed S Selim 2, Shymaa M Arafat 3 Department of Computer Science & Automatic Control, Faculty of Engineering, Alexandria University, Egypt

More information

where is a constant, 0 < <. In other words, the ratio between the shortest and longest paths from a node to a leaf is at least. An BB-tree allows ecie

where is a constant, 0 < <. In other words, the ratio between the shortest and longest paths from a node to a leaf is at least. An BB-tree allows ecie Maintaining -balanced Trees by Partial Rebuilding Arne Andersson Department of Computer Science Lund University Box 8 S-22 00 Lund Sweden Abstract The balance criterion dening the class of -balanced trees

More information

Binary Trees

Binary Trees Binary Trees 4-7-2005 Opening Discussion What did we talk about last class? Do you have any code to show? Do you have any questions about the assignment? What is a Tree? You are all familiar with what

More information

arxiv: v3 [cs.ds] 18 Apr 2011

arxiv: v3 [cs.ds] 18 Apr 2011 A tight bound on the worst-case number of comparisons for Floyd s heap construction algorithm Ioannis K. Paparrizos School of Computer and Communication Sciences Ècole Polytechnique Fèdèrale de Lausanne

More information

9/29/2016. Chapter 4 Trees. Introduction. Terminology. Terminology. Terminology. Terminology

9/29/2016. Chapter 4 Trees. Introduction. Terminology. Terminology. Terminology. Terminology Introduction Chapter 4 Trees for large input, even linear access time may be prohibitive we need data structures that exhibit average running times closer to O(log N) binary search tree 2 Terminology recursive

More information

Figure 4.1: The evolution of a rooted tree.

Figure 4.1: The evolution of a rooted tree. 106 CHAPTER 4. INDUCTION, RECURSION AND RECURRENCES 4.6 Rooted Trees 4.6.1 The idea of a rooted tree We talked about how a tree diagram helps us visualize merge sort or other divide and conquer algorithms.

More information

V Advanced Data Structures

V Advanced Data Structures V Advanced Data Structures B-Trees Fibonacci Heaps 18 B-Trees B-trees are similar to RBTs, but they are better at minimizing disk I/O operations Many database systems use B-trees, or variants of them,

More information

PAPER Constructing the Suffix Tree of a Tree with a Large Alphabet

PAPER Constructing the Suffix Tree of a Tree with a Large Alphabet IEICE TRANS. FUNDAMENTALS, VOL.E8??, NO. JANUARY 999 PAPER Constructing the Suffix Tree of a Tree with a Large Alphabet Tetsuo SHIBUYA, SUMMARY The problem of constructing the suffix tree of a tree is

More information

Optimal Region for Binary Search Tree, Rotation and Polytope

Optimal Region for Binary Search Tree, Rotation and Polytope Optimal Region for Binary Search Tree, Rotation and Polytope Kensuke Onishi Mamoru Hoshi 2 Department of Mathematical Sciences, School of Science Tokai University, 7 Kitakaname, Hiratsuka, Kanagawa, 259-292,

More information

V Advanced Data Structures

V Advanced Data Structures V Advanced Data Structures B-Trees Fibonacci Heaps 18 B-Trees B-trees are similar to RBTs, but they are better at minimizing disk I/O operations Many database systems use B-trees, or variants of them,

More information

Heap-on-Top Priority Queues. March Abstract. We introduce the heap-on-top (hot) priority queue data structure that combines the

Heap-on-Top Priority Queues. March Abstract. We introduce the heap-on-top (hot) priority queue data structure that combines the Heap-on-Top Priority Queues Boris V. Cherkassky Central Economics and Mathematics Institute Krasikova St. 32 117418, Moscow, Russia cher@cemi.msk.su Andrew V. Goldberg NEC Research Institute 4 Independence

More information

We assume uniform hashing (UH):

We assume uniform hashing (UH): We assume uniform hashing (UH): the probe sequence of each key is equally likely to be any of the! permutations of 0,1,, 1 UH generalizes the notion of SUH that produces not just a single number, but a

More information

Introduction. for large input, even access time may be prohibitive we need data structures that exhibit times closer to O(log N) binary search tree

Introduction. for large input, even access time may be prohibitive we need data structures that exhibit times closer to O(log N) binary search tree Chapter 4 Trees 2 Introduction for large input, even access time may be prohibitive we need data structures that exhibit running times closer to O(log N) binary search tree 3 Terminology recursive definition

More information

16 Greedy Algorithms

16 Greedy Algorithms 16 Greedy Algorithms Optimization algorithms typically go through a sequence of steps, with a set of choices at each For many optimization problems, using dynamic programming to determine the best choices

More information

15.4 Longest common subsequence

15.4 Longest common subsequence 15.4 Longest common subsequence Biological applications often need to compare the DNA of two (or more) different organisms A strand of DNA consists of a string of molecules called bases, where the possible

More information

The problem of minimizing the elimination tree height for general graphs is N P-hard. However, there exist classes of graphs for which the problem can

The problem of minimizing the elimination tree height for general graphs is N P-hard. However, there exist classes of graphs for which the problem can A Simple Cubic Algorithm for Computing Minimum Height Elimination Trees for Interval Graphs Bengt Aspvall, Pinar Heggernes, Jan Arne Telle Department of Informatics, University of Bergen N{5020 Bergen,

More information

II (Sorting and) Order Statistics

II (Sorting and) Order Statistics II (Sorting and) Order Statistics Heapsort Quicksort Sorting in Linear Time Medians and Order Statistics 8 Sorting in Linear Time The sorting algorithms introduced thus far are comparison sorts Any comparison

More information

An undirected graph is a tree if and only of there is a unique simple path between any 2 of its vertices.

An undirected graph is a tree if and only of there is a unique simple path between any 2 of its vertices. Trees Trees form the most widely used subclasses of graphs. In CS, we make extensive use of trees. Trees are useful in organizing and relating data in databases, file systems and other applications. Formal

More information

EE 368. Weeks 5 (Notes)

EE 368. Weeks 5 (Notes) EE 368 Weeks 5 (Notes) 1 Chapter 5: Trees Skip pages 273-281, Section 5.6 - If A is the root of a tree and B is the root of a subtree of that tree, then A is B s parent (or father or mother) and B is A

More information

Finger Search Trees with Constant Insertion Time. Gerth Stlting Brodal. Max-Planck-Institut fur Informatik. Im Stadtwald, D Saarbrucken, Germany

Finger Search Trees with Constant Insertion Time. Gerth Stlting Brodal. Max-Planck-Institut fur Informatik. Im Stadtwald, D Saarbrucken, Germany Finger Search Trees with Constant Insertion Time Gerth Stlting Brodal Max-Planck-Institut fur Informatik Im Stadtwald, D-66123 Saarbrucken, Germany Abstract We consider the problem of implementing nger

More information

Computer Science 210 Data Structures Siena College Fall Topic Notes: Priority Queues and Heaps

Computer Science 210 Data Structures Siena College Fall Topic Notes: Priority Queues and Heaps Computer Science 0 Data Structures Siena College Fall 08 Topic Notes: Priority Queues and Heaps Heaps and Priority Queues From here, we will look at some ways that trees are used in other structures. First,

More information

Finger Search Trees with Constant. Insertion Time. Gerth Stlting Brodal. Max-Planck-Institut fur Informatik. Im Stadtwald. D Saarbrucken

Finger Search Trees with Constant. Insertion Time. Gerth Stlting Brodal. Max-Planck-Institut fur Informatik. Im Stadtwald. D Saarbrucken Finger Search Trees with Constant Insertion Time Gerth Stlting Brodal Max-Planck-Institut fur Informatik Im Stadtwald D-66123 Saarbrucken Germany Email: brodal@mpi-sb.mpg.de September 26, 1997 Abstract

More information

An AVL tree with N nodes is an excellent data. The Big-Oh analysis shows that most operations finish within O(log N) time

An AVL tree with N nodes is an excellent data. The Big-Oh analysis shows that most operations finish within O(log N) time B + -TREES MOTIVATION An AVL tree with N nodes is an excellent data structure for searching, indexing, etc. The Big-Oh analysis shows that most operations finish within O(log N) time The theoretical conclusion

More information

Trees (Part 1, Theoretical) CSE 2320 Algorithms and Data Structures University of Texas at Arlington

Trees (Part 1, Theoretical) CSE 2320 Algorithms and Data Structures University of Texas at Arlington Trees (Part 1, Theoretical) CSE 2320 Algorithms and Data Structures University of Texas at Arlington 1 Trees Trees are a natural data structure for representing specific data. Family trees. Organizational

More information

March 20/2003 Jayakanth Srinivasan,

March 20/2003 Jayakanth Srinivasan, Definition : A simple graph G = (V, E) consists of V, a nonempty set of vertices, and E, a set of unordered pairs of distinct elements of V called edges. Definition : In a multigraph G = (V, E) two or

More information

HEAPS ON HEAPS* Downloaded 02/04/13 to Redistribution subject to SIAM license or copyright; see

HEAPS ON HEAPS* Downloaded 02/04/13 to Redistribution subject to SIAM license or copyright; see SIAM J. COMPUT. Vol. 15, No. 4, November 1986 (C) 1986 Society for Industrial and Applied Mathematics OO6 HEAPS ON HEAPS* GASTON H. GONNET" AND J. IAN MUNRO," Abstract. As part of a study of the general

More information

CSE 530A. B+ Trees. Washington University Fall 2013

CSE 530A. B+ Trees. Washington University Fall 2013 CSE 530A B+ Trees Washington University Fall 2013 B Trees A B tree is an ordered (non-binary) tree where the internal nodes can have a varying number of child nodes (within some range) B Trees When a key

More information

Discrete mathematics

Discrete mathematics Discrete mathematics Petr Kovář petr.kovar@vsb.cz VŠB Technical University of Ostrava DiM 470-2301/02, Winter term 2018/2019 About this file This file is meant to be a guideline for the lecturer. Many

More information

A Fast Algorithm for Optimal Alignment between Similar Ordered Trees

A Fast Algorithm for Optimal Alignment between Similar Ordered Trees Fundamenta Informaticae 56 (2003) 105 120 105 IOS Press A Fast Algorithm for Optimal Alignment between Similar Ordered Trees Jesper Jansson Department of Computer Science Lund University, Box 118 SE-221

More information

Trees Algorhyme by Radia Perlman

Trees Algorhyme by Radia Perlman Algorhyme by Radia Perlman I think that I shall never see A graph more lovely than a tree. A tree whose crucial property Is loop-free connectivity. A tree which must be sure to span. So packets can reach

More information

r (1,1) r (2,4) r (2,5) r(2,6) r (1,3) r (1,2)

r (1,1) r (2,4) r (2,5) r(2,6) r (1,3) r (1,2) Routing on Trees via Matchings? Alan Roberts 1, Antonis Symvonis 1 and Louxin Zhang 2 1 Department of Computer Science, University of Sydney, N.S.W. 2006, Australia 2 Department of Computer Science, University

More information

time using O( n log n ) processors on the EREW PRAM. Thus, our algorithm improves on the previous results, either in time complexity or in the model o

time using O( n log n ) processors on the EREW PRAM. Thus, our algorithm improves on the previous results, either in time complexity or in the model o Reconstructing a Binary Tree from its Traversals in Doubly-Logarithmic CREW Time Stephan Olariu Michael Overstreet Department of Computer Science, Old Dominion University, Norfolk, VA 23529 Zhaofang Wen

More information

Lecture 3: Art Gallery Problems and Polygon Triangulation

Lecture 3: Art Gallery Problems and Polygon Triangulation EECS 396/496: Computational Geometry Fall 2017 Lecture 3: Art Gallery Problems and Polygon Triangulation Lecturer: Huck Bennett In this lecture, we study the problem of guarding an art gallery (specified

More information

So the actual cost is 2 Handout 3: Problem Set 1 Solutions the mark counter reaches c, a cascading cut is performed and the mark counter is reset to 0

So the actual cost is 2 Handout 3: Problem Set 1 Solutions the mark counter reaches c, a cascading cut is performed and the mark counter is reset to 0 Massachusetts Institute of Technology Handout 3 6854/18415: Advanced Algorithms September 14, 1999 David Karger Problem Set 1 Solutions Problem 1 Suppose that we have a chain of n 1 nodes in a Fibonacci

More information

ADAPTIVE SORTING WITH AVL TREES

ADAPTIVE SORTING WITH AVL TREES ADAPTIVE SORTING WITH AVL TREES Amr Elmasry Computer Science Department Alexandria University Alexandria, Egypt elmasry@alexeng.edu.eg Abstract A new adaptive sorting algorithm is introduced. The new implementation

More information

Bioinformatics Programming. EE, NCKU Tien-Hao Chang (Darby Chang)

Bioinformatics Programming. EE, NCKU Tien-Hao Chang (Darby Chang) Bioinformatics Programming EE, NCKU Tien-Hao Chang (Darby Chang) 1 Tree 2 A Tree Structure A tree structure means that the data are organized so that items of information are related by branches 3 Definition

More information

C SCI 335 Software Analysis & Design III Lecture Notes Prof. Stewart Weiss Chapter 4: B Trees

C SCI 335 Software Analysis & Design III Lecture Notes Prof. Stewart Weiss Chapter 4: B Trees B-Trees AVL trees and other binary search trees are suitable for organizing data that is entirely contained within computer memory. When the amount of data is too large to fit entirely in memory, i.e.,

More information

Algorithms for Learning and Teaching. Sets of Vertices in Graphs. Patricia A. Evans and Michael R. Fellows. University of Victoria

Algorithms for Learning and Teaching. Sets of Vertices in Graphs. Patricia A. Evans and Michael R. Fellows. University of Victoria Algorithms for Learning and Teaching Sets of Vertices in Graphs Patricia A. Evans and Michael R. Fellows Department of Computer Science University of Victoria Victoria, B.C. V8W 3P6, Canada Lane H. Clark

More information

15.4 Longest common subsequence

15.4 Longest common subsequence 15.4 Longest common subsequence Biological applications often need to compare the DNA of two (or more) different organisms A strand of DNA consists of a string of molecules called bases, where the possible

More information

CS301 - Data Structures Glossary By

CS301 - Data Structures Glossary By CS301 - Data Structures Glossary By Abstract Data Type : A set of data values and associated operations that are precisely specified independent of any particular implementation. Also known as ADT Algorithm

More information

Linear Time Split Decomposition Revisited

Linear Time Split Decomposition Revisited Linear Time Split Decomposition Revisited Pierre Charbit Fabien de Montgoler Mathieu Ranot LIAFA, Univ. Paris Diderot - CNRS, ANR Project Graal {charbit,fm,raffinot}@liafa.jussieu.fr Abstract Given a family

More information

A Note on Scheduling Parallel Unit Jobs on Hypercubes

A Note on Scheduling Parallel Unit Jobs on Hypercubes A Note on Scheduling Parallel Unit Jobs on Hypercubes Ondřej Zajíček Abstract We study the problem of scheduling independent unit-time parallel jobs on hypercubes. A parallel job has to be scheduled between

More information

DDS Dynamic Search Trees

DDS Dynamic Search Trees DDS Dynamic Search Trees 1 Data structures l A data structure models some abstract object. It implements a number of operations on this object, which usually can be classified into l creation and deletion

More information

Abstract Relaxed balancing of search trees was introduced with the aim of speeding up the updates and allowing a high degree of concurrency. In a rela

Abstract Relaxed balancing of search trees was introduced with the aim of speeding up the updates and allowing a high degree of concurrency. In a rela Chromatic Search Trees Revisited Institut fur Informatik Report 9 Sabine Hanke Institut fur Informatik, Universitat Freiburg Am Flughafen 7, 79 Freiburg, Germany Email: hanke@informatik.uni-freiburg.de.

More information

Multicasting in the Hypercube, Chord and Binomial Graphs

Multicasting in the Hypercube, Chord and Binomial Graphs Multicasting in the Hypercube, Chord and Binomial Graphs Christopher C. Cipriano and Teofilo F. Gonzalez Department of Computer Science University of California, Santa Barbara, CA, 93106 E-mail: {ccc,teo}@cs.ucsb.edu

More information

Keywords: Binary Sort, Sorting, Efficient Algorithm, Sorting Algorithm, Sort Data.

Keywords: Binary Sort, Sorting, Efficient Algorithm, Sorting Algorithm, Sort Data. Volume 4, Issue 6, June 2014 ISSN: 2277 128X International Journal of Advanced Research in Computer Science and Software Engineering Research Paper Available online at: www.ijarcsse.com An Efficient and

More information

A note on Baker s algorithm

A note on Baker s algorithm A note on Baker s algorithm Iyad A. Kanj, Ljubomir Perković School of CTI, DePaul University, 243 S. Wabash Avenue, Chicago, IL 60604-2301. Abstract We present a corrected version of Baker s algorithm

More information

Part 2: Balanced Trees

Part 2: Balanced Trees Part 2: Balanced Trees 1 AVL Trees We could dene a perfectly balanced binary search tree with N nodes to be a complete binary search tree, one in which every level except the last is completely full. A

More information

Rank-Pairing Heaps. Bernard Haeupler Siddhartha Sen Robert E. Tarjan. SIAM JOURNAL ON COMPUTING Vol. 40, No. 6 (2011), pp.

Rank-Pairing Heaps. Bernard Haeupler Siddhartha Sen Robert E. Tarjan. SIAM JOURNAL ON COMPUTING Vol. 40, No. 6 (2011), pp. Rank-Pairing Heaps Bernard Haeupler Siddhartha Sen Robert E. Tarjan Presentation by Alexander Pokluda Cheriton School of Computer Science, University of Waterloo, Canada SIAM JOURNAL ON COMPUTING Vol.

More information

6. Finding Efficient Compressions; Huffman and Hu-Tucker

6. Finding Efficient Compressions; Huffman and Hu-Tucker 6. Finding Efficient Compressions; Huffman and Hu-Tucker We now address the question: how do we find a code that uses the frequency information about k length patterns efficiently to shorten our message?

More information

Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1

Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1 CME 305: Discrete Mathematics and Algorithms Instructor: Professor Aaron Sidford (sidford@stanford.edu) January 11, 2018 Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1 In this lecture

More information

Constructions of hamiltonian graphs with bounded degree and diameter O(log n)

Constructions of hamiltonian graphs with bounded degree and diameter O(log n) Constructions of hamiltonian graphs with bounded degree and diameter O(log n) Aleksandar Ilić Faculty of Sciences and Mathematics, University of Niš, Serbia e-mail: aleksandari@gmail.com Dragan Stevanović

More information

LECTURE NOTES OF ALGORITHMS: DESIGN TECHNIQUES AND ANALYSIS

LECTURE NOTES OF ALGORITHMS: DESIGN TECHNIQUES AND ANALYSIS Department of Computer Science University of Babylon LECTURE NOTES OF ALGORITHMS: DESIGN TECHNIQUES AND ANALYSIS By Faculty of Science for Women( SCIW), University of Babylon, Iraq Samaher@uobabylon.edu.iq

More information

Almost all Complete Binary Prefix Codes have a Self-Synchronizing String

Almost all Complete Binary Prefix Codes have a Self-Synchronizing String Almost all Complete Binary Prefix Codes have a Self-Synchronizing String Christopher F. Freiling Douglas S. Jungreis François Théberge Kenneth Zeger IEEE Transactions on Information Theory Submitted: February

More information

Partha Sarathi Manal

Partha Sarathi Manal MA 515: Introduction to Algorithms & MA353 : Design and Analysis of Algorithms [3-0-0-6] Lecture 11 http://www.iitg.ernet.in/psm/indexing_ma353/y09/index.html Partha Sarathi Manal psm@iitg.ernet.in Dept.

More information

Chapter 11: Graphs and Trees. March 23, 2008

Chapter 11: Graphs and Trees. March 23, 2008 Chapter 11: Graphs and Trees March 23, 2008 Outline 1 11.1 Graphs: An Introduction 2 11.2 Paths and Circuits 3 11.3 Matrix Representations of Graphs 4 11.5 Trees Graphs: Basic Definitions Informally, a

More information

A Linear Time Algorithm for the Minimum Spanning Tree Problem. on a Planar Graph. Tomomi MATSUI. (January 1994 )

A Linear Time Algorithm for the Minimum Spanning Tree Problem. on a Planar Graph. Tomomi MATSUI. (January 1994 ) A Linear Time Algorithm for the Minimum Spanning Tree Problem on a Planar Graph Tomomi MATSUI (January 994 ) Department of Mathematical Engineering and Information Physics Faculty of Engineering, University

More information

Graph and Digraph Glossary

Graph and Digraph Glossary 1 of 15 31.1.2004 14:45 Graph and Digraph Glossary A B C D E F G H I-J K L M N O P-Q R S T U V W-Z Acyclic Graph A graph is acyclic if it contains no cycles. Adjacency Matrix A 0-1 square matrix whose

More information

An Algorithm for Enumerating all Directed Spanning Trees in a Directed Graph

An Algorithm for Enumerating all Directed Spanning Trees in a Directed Graph (C) Springer Verlag, Lecture Notes on Computer Sience An Algorithm for Enumerating all Directed Spanning Trees in a Directed Graph Takeaki UNO Department of Systems Science, Tokyo Institute of Technology,

More information

Week 10. Sorting. 1 Binary heaps. 2 Heapification. 3 Building a heap 4 HEAP-SORT. 5 Priority queues 6 QUICK-SORT. 7 Analysing QUICK-SORT.

Week 10. Sorting. 1 Binary heaps. 2 Heapification. 3 Building a heap 4 HEAP-SORT. 5 Priority queues 6 QUICK-SORT. 7 Analysing QUICK-SORT. Week 10 1 2 3 4 5 6 Sorting 7 8 General remarks We return to sorting, considering and. Reading from CLRS for week 7 1 Chapter 6, Sections 6.1-6.5. 2 Chapter 7, Sections 7.1, 7.2. Discover the properties

More information

CE 221 Data Structures and Algorithms

CE 221 Data Structures and Algorithms CE 221 Data Structures and Algorithms Chapter 4: Trees (Binary) Text: Read Weiss, 4.1 4.2 Izmir University of Economics 1 Preliminaries - I (Recursive) Definition: A tree is a collection of nodes. The

More information

Knowledge Discovery from Web Usage Data: Research and Development of Web Access Pattern Tree Based Sequential Pattern Mining Techniques: A Survey

Knowledge Discovery from Web Usage Data: Research and Development of Web Access Pattern Tree Based Sequential Pattern Mining Techniques: A Survey Knowledge Discovery from Web Usage Data: Research and Development of Web Access Pattern Tree Based Sequential Pattern Mining Techniques: A Survey G. Shivaprasad, N. V. Subbareddy and U. Dinesh Acharya

More information

The Level Ancestor Problem simplied

The Level Ancestor Problem simplied Theoretical Computer Science 321 (2004) 5 12 www.elsevier.com/locate/tcs The Level Ancestor Problem simplied Michael A. Bender a; ;1, Martn Farach-Colton b;2 a Department of Computer Science, State University

More information

CISC 235: Topic 4. Balanced Binary Search Trees

CISC 235: Topic 4. Balanced Binary Search Trees CISC 235: Topic 4 Balanced Binary Search Trees Outline Rationale and definitions Rotations AVL Trees, Red-Black, and AA-Trees Algorithms for searching, insertion, and deletion Analysis of complexity CISC

More information

The 3-Steiner Root Problem

The 3-Steiner Root Problem The 3-Steiner Root Problem Maw-Shang Chang 1 and Ming-Tat Ko 2 1 Department of Computer Science and Information Engineering National Chung Cheng University, Chiayi 621, Taiwan, R.O.C. mschang@cs.ccu.edu.tw

More information

Dictionaries. Priority Queues

Dictionaries. Priority Queues Red-Black-Trees.1 Dictionaries Sets and Multisets; Opers: (Ins., Del., Mem.) Sequential sorted or unsorted lists. Linked sorted or unsorted lists. Tries and Hash Tables. Binary Search Trees. Priority Queues

More information

18.3 Deleting a key from a B-tree

18.3 Deleting a key from a B-tree 18.3 Deleting a key from a B-tree B-TREE-DELETE deletes the key from the subtree rooted at We design it to guarantee that whenever it calls itself recursively on a node, the number of keys in is at least

More information

A General Class of Heuristics for Minimum Weight Perfect Matching and Fast Special Cases with Doubly and Triply Logarithmic Errors 1

A General Class of Heuristics for Minimum Weight Perfect Matching and Fast Special Cases with Doubly and Triply Logarithmic Errors 1 Algorithmica (1997) 18: 544 559 Algorithmica 1997 Springer-Verlag New York Inc. A General Class of Heuristics for Minimum Weight Perfect Matching and Fast Special Cases with Doubly and Triply Logarithmic

More information

Diversity Coloring for Distributed Storage in Mobile Networks

Diversity Coloring for Distributed Storage in Mobile Networks Diversity Coloring for Distributed Storage in Mobile Networks Anxiao (Andrew) Jiang and Jehoshua Bruck California Institute of Technology Abstract: Storing multiple copies of files is crucial for ensuring

More information

Revised version, February 1991, appeared in Information Processing Letters 38 (1991), 123{127 COMPUTING THE MINIMUM HAUSDORFF DISTANCE BETWEEN

Revised version, February 1991, appeared in Information Processing Letters 38 (1991), 123{127 COMPUTING THE MINIMUM HAUSDORFF DISTANCE BETWEEN Revised version, February 1991, appeared in Information Processing Letters 38 (1991), 123{127 COMPUTING THE MINIMUM HAUSDORFF DISTANCE BETWEEN TWO POINT SETS ON A LINE UNDER TRANSLATION Gunter Rote Technische

More information

Enumerating All Rooted Trees Including k Leaves

Enumerating All Rooted Trees Including k Leaves IEICE TRANS. INF. & SYST., VOL.E95 D, NO.3 MARCH 2012 763 PAPER Special Section on Foundations of Computer Science Enumerating All Rooted Trees Including k Leaves Masanobu ISHIKAWA a), Nonmember, Katsuhisa

More information

Week 10. Sorting. 1 Binary heaps. 2 Heapification. 3 Building a heap 4 HEAP-SORT. 5 Priority queues 6 QUICK-SORT. 7 Analysing QUICK-SORT.

Week 10. Sorting. 1 Binary heaps. 2 Heapification. 3 Building a heap 4 HEAP-SORT. 5 Priority queues 6 QUICK-SORT. 7 Analysing QUICK-SORT. Week 10 1 Binary s 2 3 4 5 6 Sorting Binary s 7 8 General remarks Binary s We return to sorting, considering and. Reading from CLRS for week 7 1 Chapter 6, Sections 6.1-6.5. 2 Chapter 7, Sections 7.1,

More information

Trees. (Trees) Data Structures and Programming Spring / 28

Trees. (Trees) Data Structures and Programming Spring / 28 Trees (Trees) Data Structures and Programming Spring 2018 1 / 28 Trees A tree is a collection of nodes, which can be empty (recursive definition) If not empty, a tree consists of a distinguished node r

More information

Lecture 6: External Interval Tree (Part II) 3 Making the external interval tree dynamic. 3.1 Dynamizing an underflow structure

Lecture 6: External Interval Tree (Part II) 3 Making the external interval tree dynamic. 3.1 Dynamizing an underflow structure Lecture 6: External Interval Tree (Part II) Yufei Tao Division of Web Science and Technology Korea Advanced Institute of Science and Technology taoyf@cse.cuhk.edu.hk 3 Making the external interval tree

More information

Using the Holey Brick Tree for Spatial Data. in General Purpose DBMSs. Northeastern University

Using the Holey Brick Tree for Spatial Data. in General Purpose DBMSs. Northeastern University Using the Holey Brick Tree for Spatial Data in General Purpose DBMSs Georgios Evangelidis Betty Salzberg College of Computer Science Northeastern University Boston, MA 02115-5096 1 Introduction There is

More information

Binary Trees, Binary Search Trees

Binary Trees, Binary Search Trees Binary Trees, Binary Search Trees Trees Linear access time of linked lists is prohibitive Does there exist any simple data structure for which the running time of most operations (search, insert, delete)

More information

Smoothsort's Behavior on Presorted Sequences. Stefan Hertel. Fachbereich 10 Universitat des Saarlandes 6600 Saarbrlicken West Germany

Smoothsort's Behavior on Presorted Sequences. Stefan Hertel. Fachbereich 10 Universitat des Saarlandes 6600 Saarbrlicken West Germany Smoothsort's Behavior on Presorted Sequences by Stefan Hertel Fachbereich 10 Universitat des Saarlandes 6600 Saarbrlicken West Germany A 82/11 July 1982 Abstract: In [5], Mehlhorn presented an algorithm

More information

Fast algorithm for generating ascending compositions

Fast algorithm for generating ascending compositions manuscript No. (will be inserted by the editor) Fast algorithm for generating ascending compositions Mircea Merca Received: date / Accepted: date Abstract In this paper we give a fast algorithm to generate

More information

ICS 691: Advanced Data Structures Spring Lecture 8

ICS 691: Advanced Data Structures Spring Lecture 8 ICS 691: Advanced Data Structures Spring 2016 Prof. odari Sitchinava Lecture 8 Scribe: Ben Karsin 1 Overview In the last lecture we continued looking at arborally satisfied sets and their equivalence to

More information

Binary Heaps in Dynamic Arrays

Binary Heaps in Dynamic Arrays Yufei Tao ITEE University of Queensland We have already learned that the binary heap serves as an efficient implementation of a priority queue. Our previous discussion was based on pointers (for getting

More information

Analysis of Algorithms

Analysis of Algorithms Algorithm An algorithm is a procedure or formula for solving a problem, based on conducting a sequence of specified actions. A computer program can be viewed as an elaborate algorithm. In mathematics and

More information

Clustering Using Graph Connectivity

Clustering Using Graph Connectivity Clustering Using Graph Connectivity Patrick Williams June 3, 010 1 Introduction It is often desirable to group elements of a set into disjoint subsets, based on the similarity between the elements in the

More information

Topics. Trees Vojislav Kecman. Which graphs are trees? Terminology. Terminology Trees as Models Some Tree Theorems Applications of Trees CMSC 302

Topics. Trees Vojislav Kecman. Which graphs are trees? Terminology. Terminology Trees as Models Some Tree Theorems Applications of Trees CMSC 302 Topics VCU, Department of Computer Science CMSC 302 Trees Vojislav Kecman Terminology Trees as Models Some Tree Theorems Applications of Trees Binary Search Tree Decision Tree Tree Traversal Spanning Trees

More information

Algorithm Design Techniques (III)

Algorithm Design Techniques (III) Algorithm Design Techniques (III) Minimax. Alpha-Beta Pruning. Search Tree Strategies (backtracking revisited, branch and bound). Local Search. DSA - lecture 10 - T.U.Cluj-Napoca - M. Joldos 1 Tic-Tac-Toe

More information

Trees : Part 1. Section 4.1. Theory and Terminology. A Tree? A Tree? Theory and Terminology. Theory and Terminology

Trees : Part 1. Section 4.1. Theory and Terminology. A Tree? A Tree? Theory and Terminology. Theory and Terminology Trees : Part Section. () (2) Preorder, Postorder and Levelorder Traversals Definition: A tree is a connected graph with no cycles Consequences: Between any two vertices, there is exactly one unique path

More information

A New Approach to Graph Recognition and Applications to Distance-Hereditary Graphs

A New Approach to Graph Recognition and Applications to Distance-Hereditary Graphs Nakano S-i, Uehara R, Uno T. A new approach to graph recognition and applications to distance-hereditary graphs. JOUR- NAL OF COMPUTER SCIENCE AND TECHNOLOGY 24(3): 517 533 May 2009 A New Approach to Graph

More information

Computer Science 385 Analysis of Algorithms Siena College Spring Topic Notes: Introduction and Overview

Computer Science 385 Analysis of Algorithms Siena College Spring Topic Notes: Introduction and Overview Computer Science 385 Analysis of Algorithms Siena College Spring 2011 Topic Notes: Introduction and Overview Welcome to Analysis of Algorithms! What is an Algorithm? A possible definition: a step-by-step

More information

st-orientations September 29, 2005

st-orientations September 29, 2005 st-orientations September 29, 2005 Introduction Let G = (V, E) be an undirected biconnected graph of n nodes and m edges. The main problem this chapter deals with is different algorithms for orienting

More information

Lecturers: Sanjam Garg and Prasad Raghavendra March 20, Midterm 2 Solutions

Lecturers: Sanjam Garg and Prasad Raghavendra March 20, Midterm 2 Solutions U.C. Berkeley CS70 : Algorithms Midterm 2 Solutions Lecturers: Sanjam Garg and Prasad aghavra March 20, 207 Midterm 2 Solutions. (0 points) True/False Clearly put your answers in the answer box in front

More information

Recoloring k-degenerate graphs

Recoloring k-degenerate graphs Recoloring k-degenerate graphs Jozef Jirásek jirasekjozef@gmailcom Pavel Klavík pavel@klavikcz May 2, 2008 bstract This article presents several methods of transforming a given correct coloring of a k-degenerate

More information

Lecture 3 February 20, 2007

Lecture 3 February 20, 2007 6.897: Advanced Data Structures Spring 2007 Prof. Erik Demaine Lecture 3 February 20, 2007 Scribe: Hui Tang 1 Overview In the last lecture we discussed Binary Search Trees and the many bounds which achieve

More information

On k-dimensional Balanced Binary Trees*

On k-dimensional Balanced Binary Trees* journal of computer and system sciences 52, 328348 (1996) article no. 0025 On k-dimensional Balanced Binary Trees* Vijay K. Vaishnavi Department of Computer Information Systems, Georgia State University,

More information

arxiv: v2 [cs.ds] 9 Apr 2009

arxiv: v2 [cs.ds] 9 Apr 2009 Pairing Heaps with Costless Meld arxiv:09034130v2 [csds] 9 Apr 2009 Amr Elmasry Max-Planck Institut für Informatik Saarbrücken, Germany elmasry@mpi-infmpgde Abstract Improving the structure and analysis

More information

n2k log tr and n 2 log tr algorithms for the restricted and nonrestricted cases, respectively. OPTIMAL ALPHABETIC TREES*

n2k log tr and n 2 log tr algorithms for the restricted and nonrestricted cases, respectively. OPTIMAL ALPHABETIC TREES* SIAM J. COMPUT. Voi. 5, No. 1, March 1976 OPTIMAL ALPHABETIC TREES* ALON ITAIf Abstract. An algorithm of Knuth for finding an optimal binary tree is extended in several directions to solve related problems.

More information

Modular Representations of Graphs

Modular Representations of Graphs Modular Representations of Graphs Crystal Altamirano, Stephanie Angus, Lauren Brown, Joseph Crawford, and Laura Gioco July 2011 Abstract A graph G has a representation modulo r if there exists an injective

More information

Solutions. (a) Claim: A d-ary tree of height h has at most 1 + d +...

Solutions. (a) Claim: A d-ary tree of height h has at most 1 + d +... Design and Analysis of Algorithms nd August, 016 Problem Sheet 1 Solutions Sushant Agarwal Solutions 1. A d-ary tree is a rooted tree in which each node has at most d children. Show that any d-ary tree

More information

Combinatorial Problems on Strings with Applications to Protein Folding

Combinatorial Problems on Strings with Applications to Protein Folding Combinatorial Problems on Strings with Applications to Protein Folding Alantha Newman 1 and Matthias Ruhl 2 1 MIT Laboratory for Computer Science Cambridge, MA 02139 alantha@theory.lcs.mit.edu 2 IBM Almaden

More information

TU/e Algorithms (2IL15) Lecture 2. Algorithms (2IL15) Lecture 2 THE GREEDY METHOD

TU/e Algorithms (2IL15) Lecture 2. Algorithms (2IL15) Lecture 2 THE GREEDY METHOD Algorithms (2IL15) Lecture 2 THE GREEDY METHOD x y v w 1 Optimization problems for each instance there are (possibly) multiple valid solutions goal is to find an optimal solution minimization problem:

More information

Algorithmic Aspects of Communication Networks

Algorithmic Aspects of Communication Networks Algorithmic Aspects of Communication Networks Chapter 5 Network Resilience Algorithmic Aspects of ComNets (WS 16/17): 05 Network Resilience 1 Introduction and Motivation Network resilience denotes the

More information

2-3 Tree. Outline B-TREE. catch(...){ printf( "Assignment::SolveProblem() AAAA!"); } ADD SLIDES ON DISJOINT SETS

2-3 Tree. Outline B-TREE. catch(...){ printf( Assignment::SolveProblem() AAAA!); } ADD SLIDES ON DISJOINT SETS Outline catch(...){ printf( "Assignment::SolveProblem() AAAA!"); } Balanced Search Trees 2-3 Trees 2-3-4 Trees Slide 4 Why care about advanced implementations? Same entries, different insertion sequence:

More information