Faster, Space-Efficient Selection Algorithms in Read-Only Memory for Integers

Size: px
Start display at page:

Download "Faster, Space-Efficient Selection Algorithms in Read-Only Memory for Integers"

Transcription

1 Faster, Space-Efficient Selection Algorithms in Read-Only Memory for Integers Timothy M. Chan 1, J. Ian Munro 1, and Venkatesh Raman 2 1 Cheriton School of Computer Science, University of Waterloo, Waterloo, Ontario N2L 3G1, Canada, {tmchan,imunro}@uwaterloo.ca 2 The Institute of Mathematical sciences, Chennai , India, vraman@imsc.res.in Abstract. Starting with Munro and Paterson (1980), the selection or median-finding problem has been extensively studied in the read-only memory model and in streaming models. Munro and Paterson s deterministic algorithm and its subsequent refinements require at least polylogarithmic or logarithmic space, whereas the algorithms by Munro and Raman (1996) and Raman and Ramnath (1999) can be made to use just O(1) storage cells but take O(n 1+ε ) time for an arbitrarily small constant ε > 0. In this paper, we show that faster selection algorithms in read-only memory are possible if the input is a sequence of integers. For example, one algorithm uses O(1) storage cells and takes O(n lg U) time where U is the universe size. Another algorithm uses O(1) storage cells and takes O(n lg n lg lg U) time. We also describe an O(n)-time algorithm for finding an approximate median using O(lg ε U) storage cells. All our algorithms are simple and deterministic. Interestingly, one of our algorithms is inspired by centroids of binary trees and finds an approximate median by repeatedly invoking a textbook algorithm for the majority problem. This technique could be of independent interest. 1 Introduction The topic of this paper is the classical selection problem, where we want to find the k-th smallest element of an input sequence of n elements for a given number k. (The median corresponds to the k = n/2 case.) Specifically, we are interested in space-efficient algorithms in the read-only memory model, where the input is a read-only array and we want to minimize the amount of extra space needed in addition to the input array. Selection in read-only memory has been studied since Munro and Paterson s pioneering work on streaming algorithms [13]. Their deterministic algorithm runs in O(n lg s n + n lg s) time using O(s) storage cells, for any given s = Ω(lg 2 n). Frederickson [9] refined the running time to O(n lg s n+n lg s). (This bound has been recently improved [8] slightly in the extreme end when s approaches n/ lg n.) All these algorithms work by finding an approximate median in one pass, which is used to find the exact median or the k-th smallest element over several passes.

2 The space of one-pass streaming algorithms for approximate medians has been improved to O(lg n) cells by Greenwald and Khanna [11]; this could potentially extend the range of allowed values for s to Ω(lg n). However, for small, sublogarithmic space, the best time bound increases dramatically. Munro and Raman [14] gave an O(2 s sn 1+1/s )-time algorithm, and this was improved to O(sn 1+1/s lg n) by Raman and Ramnath [15], for any s from 1 to lg n. If randomization is allowed, much better results are possible. Chan [6] provided a matching upper and lower bound of Θ(n lg lg s n) on the expected running time for all s from 1 to n. Our focus here, however, will be on deterministic algorithms only. All the above results are in the comparison model. In this paper, we study the selection problem in the setting where the input elements are integers in [U] := {1, 2,..., U}. Our model of computation is the word RAM model where standard (arithmetic, shift and bitwise logical) word operations can be performed in constant time. We assume that each word is w bits long, and w is at least lg n and lg U, so that a pointer or input integer can fit in a word. We assume that each memory cell can store a word. The case of integer input is standard when studying general lower bounds, for example, for sorting in the read-only memory model [1, 3], and randomized selection in the streaming model [5]; these lower bounds often match or nearly match their corresponding upper bounds in the comparison model. In contrast, we show that the integer assumption makes a big difference for the deterministic selection problem in read-only memory with small space. Our results are the following: 1. a selection algorithm using O(n lg s U) time and O(s) words of space for any s from 1 to n; 2. a selection algorithm using O(n lg n lg s lg U) time and O(s) words of space for any s from 1 to lg U. The first algorithm, presented in Section 2, is very simple and works well when the universe size U is polynomially bounded. For example, for s = 1 and U = n O(1), the running time is O(n lg n), which is significantly faster than those of Munro and Raman or Raman and Ramnath for constant s. For s = lg ε n and U = n O(1), the running time is O(n lg n/ lg lg n), where ε denotes an arbitrarily small positive constant. For s = n ε and U = n O(1), we get linear running time, eliminating the iterated logarithmic factor from Frederickson s result. The second algorithm, presented in Section 3, is less sensitive to U and beats previous algorithms for a wider range of universe sizes. On our way to obtaining this second result, we also give 3. an approximate median algorithm using O(n lg s lg U) time and O(s) words of space for any s from 1 to lg U. For s = 1, the time bound is O(n lg lg U). For s = lg ε U, it is linear. The algorithm makes a clever use of a well-known algorithm, first published in [4] 2

3 (discovered in 1980) to find the majority of a sequence of bits. To speed up this algorithm, we give a procedure to find the majority at several prefix lengths of the given sequence simultaneously in linear time. The resulting linear-time algorithm for approximate median is relatively simple and self-contained, and immediately implies a new deterministic linear-time algorithm for selection in the traditional, non-space-efficient setting, when the input elements are integers. This may be of independent interest, as the standard deterministic linear-time algorithm for selection [2] requires a doubly recursive structure, which the new algorithm manages to avoid. When the two algorithms are combined, it is possible to obtain, for example, a selection algorithm that uses O(1) words of space and whose running time is guaranteed to be at most O(n lg 1+ε n) regardless of the universe size U. This consequence is noted in Section 4. We should mention that at least one prior work on approximate medians has also addressed upper bounds for the integer case: Shrivastava et al. [16] gave onepass streaming algorithms for maintaining approximate quantiles using O(lg U) words of space. There are some similarities, but our approach is simpler, besides being more space-efficient (they maintained information about the trie induced by the binary representations of the numbers, whereas we maintain just one path in the trie, since we do not need all approximate quantiles). Like many other works in streaming algorithms, they were less interested in analyzing the total running time. It is conceivable that some of the previous streaming algorithms on approximate medians could be sped up in the integer case by using advanced data structures such as the fusion tree [10]. Our algorithms however do not require such complicated data structures. 2 An O(n lg s U)-time algorithm We assume that the input integers are in the range [U], and the aim is to find the k-th smallest element in the sequence of n integers. We give a very simple selection algorithm in read-only memory that takes O(n lg U) time using O(1) space. The algorithm goes through lg U stages where in stage i, we determine the i-th bit of the solution. At the first stage, we simply count the number of input integers with leading bit 0 and leading bit 1 and based on k, we determine the first bit of the answer, and update k to be the new rank of the element to be found among those input integers with the leading bit same as that of the answer. We repeat the same procedure in the i-th stage, for i > 1 (having computed the i 1 bits of the answer) by counting how many integers, among those matching the first i 1 bits of the answer, have the i-th bit 0 and how many have the i-th bit 1, updating k and recursing appropriately. Thus we immediately obtain the following result: Theorem 1. Given a sequence of n integers in the range [U], we can find the k-th smallest element of the sequence using O(lg U) passes, in O(n lg U) time using O(1) words of space, in read-only memory. 3

4 If we have s = 2 b extra cells available, then we can read b bits of the input in each pass counting the number of inputs with each b-bit value using the 2 b counters, and finding b bits of the answer at each stage. The number of stages is thus reduced to O((lg U)/b). To ensure O(n) run time for each pass, we limit the number of counters s to n. This results in the following theorem. Theorem 2. Given a sequence of n integers in the range [U], we can find the k-th smallest element of the sequence using O(lg s U) passes in O(n lg s U) time using O(s) words of space, in read-only memory for any s n. 3 An O(n lg n lg s lg U)-time algorithm Our next approach solves the selection problem by designing better algorithms for finding an approximate median specifically, an element whose rank is between n/4 and 3n/4. The connection between exact selection and approximate median is well known. Given an algorithm for the latter problem, we can apply it to find an approximate median m for the subsequence of all input elements inside a current interval [l, r] that contains the answer; we can then compute the rank of m in one additional pass, and then shrink [l, r] to either [l, m] or [m, r], depending on whether the rank of m is greater or less than k. After about lg 4/3 n iterations, the interval will be shrunk to a single point. If the given approximate median algorithm makes P passes over the input, has running time proportional to the cost of the P linear scans, and uses O(s) space, then the overall algorithm has running time O(nP lg n) and uses O(s) space. We first present a simple algorithm to find an approximate median using O(lg lg U) passes and O(1) space. Our idea is inspired by the standard construction of a centroid of a binary tree (namely, the trie formed by the binary representations of the input integers). Theorem 3. An approximate median from a range of [U] can be found in O(lg lg U) passes and O(n lg lg U) time in read-only memory using O(1) words of space. Hence the k-th smallest element can be found in O(n lg n lg lg U) time in read-only memory using O(1) words of space. Proof. The idea is to find the longest prefix p such that the number of integers in the input sequence whose binary representations starts with p is more than n/2. Let m 0 and m 1 be the smallest input integer with prefix p0 and prefix p1 respectively, and let m 2 be the largest input integer with prefix p1. Let r 0, r 1, r 2 be the ranks of m 0, m 1, m 2 respectively. As r 1 r 0 n/2, r 2 r 1 n/2, and r 2 r 0 n/2 (due to the choice of p), it is easy to see that at least one of r 0, r 1, r 2 must lie in [n/4, 3n/4]. So, we can report one of m 0, m 1, m 2 as an approximate median. Now, to find this longest prefix p, we use a standard binary-search over the lengths. We maintain an interval containing the desired prefix length (which is the entire length of lg U to start with). We take the midpoint of the interval, and if we find that this length has no element that occurs more than n/2 times (i.e., 4

5 has no majority element), then we replace the interval with its lower half, else we replace the interval with its upper half. The number of iterations is O(lg lg U). At each prefix length, we need to decide whether a majority element exists in of a list of n elements. There is a well-known textbook algorithm that solves the majority problem in O(n) time, in two passes. We include a brief description, as it will be useful later. In the first pass, the pseudocode below finds a possible candidate p for the majority of A[1],..., A[n]: 1. initialize c = 0 2. for t = 1,..., n: 3. if c = 0 then set p = A[t] 4. if A[t] = p then increment c else decrement c The claim is that after each iteration t, ( ) if the majority of A[1],..., A[t] exists, then it must be p. This can be seen from the following invariants: Let t be the last value such that c = 0 at the end of iteration t. Then (a) (b) A[1],..., A[t ] do not have a majority; and c = [# of times p occurs in A[t + 1],..., A[t]] [# of times p does not occur in A[t + 1],..., A[t]] 0. By (b), the majority of A[t +1],..., A[t] is p if c > 0, and does not exist if c = 0. Together with (a), this implies that ( ), because of the following property: the majority of the concatenation of two lists, if it exists, must be the majority of one of the two lists. After computing the candidate majority p, we can in a second pass compute its frequency and then check whether it is more than n/2. Once we find the longest prefix p, we find m 0, m 1 and m 2 and their ranks r 0, r 1 and r 2 respectively in two additional passes in O(n) time. We show how to speed up the preceding algorithm when we allow a little more space: Theorem 4. An approximate median can be found in O(n lg s lg U) time using O(s) words of space in read-only memory for any s lg U. Hence the k-th smallest element can be found in O(n lg n lg s lg U) time using O(s) words of space in read-only memory. Proof. We speed up the preceding binary search with an s-ary search, which reduces the number of iterations to O(lg s lg U). This requires extending the majority algorithm to compute majority candidates for s length values simultaneously, in two passes. More precisely, let A[1],..., A[n] be the input array, let l 1,..., l s be s given lengths in increasing order, and let π i (p) denote the length- l i prefix of the binary representation of p. We want to compute a candidate for the majority of π i (A[1]),..., π i (A[n]) for every i = 1,..., s. 5

6 The pseudocode for the modified majority algorithm is given below. The key is to observe that we can make the s majority candidates to be prefixes of one common string p. This requires one subtle twist in the algorithm, where a counter may in one particular case stay at zero without being incremented or decremented: 0. initialize c 1,..., c s to 0, p to 0 1. for t = 1,..., n: 2. find the smallest j with π j (A[t]) π j (p) 3. if c j = 0 (or j does not exist) then 4. set p = A[t] and increment c 1,..., c s 5. else increment c 1,..., c j 1 6. decrement the nonzero entries of c j,..., c s Correctness. The claim is that after each iteration t, for each i, ( ) if the majority of π i (A[1]),..., π i (A[t]) exists, then it is π i (p), and c i 0. Let t i be the last value such that c i = 0 at the end of iteration t i. Then the following three invariants are true: (a) π i (A[1]),..., π i (A[t i ]) do not have a majority; (b) c i = [# of times π i (p) occurs in π i (A[t i + 1]),..., π i (A[t])] [# of times π i (p) does not occur in π i (A[t i + 1]),..., π i (A[t])] 0; (c) c 1 c 2 c s. First we argue that ( ) follows from the three invariants. By (b), the majority of π i (A[t i + 1]),..., π i (A[t]) is π i (p) if c i > 0, and does not exist if c i = 0. Together with (a), this implies ( ). It is straightforward to verify that the invariants are preserved in the case when lines 3 4 are executed (here, c j = = c b = 0 by (c)). So consider the c j 0 case instead when lines 5 6 are executed. It is straightforward to see that the invariants are preserved for any index i where c i is incremented or decremented. The remaining subcase is when i > j and c i is zero, and is not decremented, but stays at zero. Then a majority of π i (A[1]),..., π i (A[t 1]) does not exist. To maintain (a), we need to confirm that a majority of π i (A[1]),..., π i (A[t]) does not exist. Assume otherwise. Then this majority must be π i (A[t]). This would imply that the majority of π j (A[1]),..., π j (A[t]) is π j (A[t]), but this majority can only be π j (p): a contradiction with π j (A[t]) π j (p). Implementation. Line 2 can be performed in O(1) time by taking the exclusive-or of A[t] and p and identifying the most significant 1-bit (a commonly encountered operation, which is known to be reducible to O(1) standard word operations [10]). Lines 4, 5, and 6 require increment/decrement operations on length-s vectors, which can be done using a known data structure for dynamic counting by Dietz [7]. Because s is small, however, the data structure can be greatly simplified and we can give a short description. 6

7 The idea is to express (c s,..., c 1 ) as a sum (c s,..., c 1)+(δ s,..., δ 1 ), where the first vector does not change often and the second vector is kept small. Specifically, after a round of s 1 iterations, we reset c i = max{c i s, 0} and δ i = c i c i 0; the amortized cost of the reset is O(1). During a round, updates are applied to the δ i s. Then δ i < 2s at all times, so (δ s,..., δ 1 ) can be packed in one word provided that s lg s = o(lg U). If s lg s = Ω(lg U), we can change s to lg U, for example, and the result is the same because O(n lg s lg U) is the same as O(n). Testing whether c i = 0 is equivalent to testing whether δ i = 0. Line 4 corresponds to adding a constant (1,..., 1) to (δ s,..., δ 1 ) and lines 5 6 correspond to adding a vector of the form (0,..., 0, 1,..., 1) and subtracting a vector of the form (0,..., 0, 1,..., 1, 0,..., 0). These reduce to O(1) standard arithmetic operations on words. Before we decrement, we need to identify the smallest i with δ i = 0; this reduces to finding the most significant 1-bit in (δ s,..., δ 1 ). Thus, the algorithm can be implemented to run in O(n) time. It uses O(s) words of space for storing p and (c s,..., c 1 ). After computing the candidate majorities π i (p), we can in a second pass compute their frequencies f i : initialize f 1,..., f s to 0, and for each t = 1,..., n, find the smallest j with π j (A[t]) π j (p) and increment f 1,..., f j 1. By the same approach, the second pass takes O(n) time as well. We can then check which of the frequencies are more than n/2. 4 Final Remarks We have shown that the selection problem for integers in read-only memory can be solved deterministically in O(min{n lg s U, n lg n lg s lg U ) time with O(s) storage cells. Actually in all our algorithms, all but a constant number of cells in the extra memory store O(lg n)-bit pointers or counters rather than O(lg U)-bit integers. Thus, the space used in bits is O(lg U + s lg n). For example, we can { set s = lg U/ lg n to ensure O(lg } U) bits of space, and a lg U time bound of O(min n lg(lg U/ lg n), n lg n lg lg U lg(lg U/ lg n) ). Notice that the second term is O(n lg n) when lg U lg 1+ε n. On the other hand, when lg U lg 1+ε n, the first term is at most O(n lg 1+ε n). So, a combination of our two approaches yields an algorithm that uses O(1) words of space and always runs in at most O(n lg 1+ε n) time a bound independent of U. A remaining question is whether there is a deterministic selection algorithm for integers in read-only memory that uses O(1) words of space and runs in O(n lg n) time (or better) for all U. Another question is to what extent can our approximate median algorithm be improved; for example, is there a deterministic linear-time algorithm using O(1) words of space in read-only memory? Also, in the comparison model, the best deterministic algorithm with O(1) space currently requires O(n 1+ε ) time in read-only memory [14, 15]. Can one prove a matching lower bound? This question appears difficult. Finally, as was mentioned in the introduction, if randomization is allowed, Θ(n lg lg s n) expected time algorithm is possible using O(s) storage cells for 7

8 general input. Can one extend the Ω(n lg lg s n) lower bound proof [6] to a noncomparison model in the case when the input is a sequence of integers? References 1. P. Beame, A general sequential time-space tradeoff for finding unique elements, SIAM Journal on Computing 20(2): (1991). 2. M. Blum, R. W. Floyd, V. Pratt, R. L. Rivest and R. E. Tarjan, Time bounds for selection, Journal of Computer and System Sciences 7: (1973). 3. A. Borodin and S. A. Cook, A time-space tradeoff for sorting on a general sequential model of computation, SIAM Journal on Computing 11: (1982). 4. R. S. Boyer and J. S. Moore, MJRTY - A fast majority vote algorithm, Automated Reasoning: Essays in Honor of Woody Bledsoe (R. S. Boyer, Ed.), Automated Reasoning Series, Kluwer, (1991). 5. A. Chakrabarti, T. S. Jayram and M. Pǎtraşcu, Tight lower bound for selection in randomly ordered streams, Proceedings of the 19th ACM-SIAM Symposium on Discrete Algorithms (SODA): (2008). 6. T. M. Chan, Comparison-based time-space lower bounds for selection, ACM Transactions on Algorithms 6(2): 26 (2010). 7. P. F. Dietz, Optimal algorithms for list indexing and subset rank, Proceedings of the First Workshop on Algorithms and Data Structures (WADS): (1989). 8. A. Elmasry, D. Dahl Juhl, J. Katajainen and S. Rao Satti, Selection from readonly memory with limited work space, Proceedings of COCOON 2013: (2013). 9. G. Frederickson, Upper bounds for time-space trade-offs in sorting and selection, Journal of Computer and System Sciences 34(1): (1987). 10. M. L. Fredman and D. E. Willard, Surpassing the information theoretic bound with fusion trees, Journal of Computer and System Sciences, 47: (1993). 11. M. Greenwald and S. Khanna, Space-efficient online computation of quantile summaries, Proceedings of ACM SIGMOD: (2001). 12. G. S. Manku, S. Rajagopalan and B. G. Lindsay, Approximate medians and other quantiles in one pass with limited memory, Proceedings of ACM SIGMOD 27(2) (1998). 13. J. I. Munro and M. Paterson, Selection and sorting with limited storage, Theoretical Computer Science 12: (1980). 14. J. I. Munro and V. Raman, Selection from read-only memory and sorting with optimum data movement, Theoretical Computer Science 165(2): (1996). 15. V. Raman and S. Ramnath, Improved upper bounds for time-space tradeoffs for selection, Nordic Journal of Computing, 6 (2): (1999). 16. N. Shrivastava, C. Buragohain, D. Agrawal, S. Suri, Medians and beyond: new aggregation techniques for sensor networks, Proceedings of the 2nd International Conference on Embedded Networked Sensor Systems: (2004). 8

Selection from Read-Only Memory with Limited Workspace

Selection from Read-Only Memory with Limited Workspace Selection from Read-Only Memory with Limited Workspace Srinivasa Rao Satti Seoul National University Joint work with Amr Elmasry, Daniel Dahl Juhl, and Jyrki Katajainen Outline Models and Problem definition

More information

Selection and Sorting in the Restore Model

Selection and Sorting in the Restore Model Selection and Sorting in the Restore Model Timothy M. Chan J. Ian Munro Venkatesh Raman Abstract We consider the classical selection and sorting problems in a model where the initial permutation of the

More information

Quake Heaps: A Simple Alternative to Fibonacci Heaps

Quake Heaps: A Simple Alternative to Fibonacci Heaps Quake Heaps: A Simple Alternative to Fibonacci Heaps Timothy M. Chan Cheriton School of Computer Science, University of Waterloo, Waterloo, Ontario N2L G, Canada, tmchan@uwaterloo.ca Abstract. This note

More information

Representing Dynamic Binary Trees Succinctly

Representing Dynamic Binary Trees Succinctly Representing Dynamic Binary Trees Succinctly J. Inn Munro * Venkatesh Raman t Adam J. Storm* Abstract We introduce a new updatable representation of binary trees. The structure requires the information

More information

Misra-Gries Summaries

Misra-Gries Summaries Title: Misra-Gries Summaries Name: Graham Cormode 1 Affil./Addr. Department of Computer Science, University of Warwick, Coventry, UK Keywords: streaming algorithms; frequent items; approximate counting

More information

Convex Hull of the Union of Convex Objects in the Plane: an Adaptive Analysis

Convex Hull of the Union of Convex Objects in the Plane: an Adaptive Analysis CCCG 2008, Montréal, Québec, August 13 15, 2008 Convex Hull of the Union of Convex Objects in the Plane: an Adaptive Analysis Jérémy Barbay Eric Y. Chen Abstract We prove a tight asymptotic bound of Θ(δ

More information

Bichromatic Line Segment Intersection Counting in O(n log n) Time

Bichromatic Line Segment Intersection Counting in O(n log n) Time Bichromatic Line Segment Intersection Counting in O(n log n) Time Timothy M. Chan Bryan T. Wilkinson Abstract We give an algorithm for bichromatic line segment intersection counting that runs in O(n log

More information

Lecture 12 March 21, 2007

Lecture 12 March 21, 2007 6.85: Advanced Data Structures Spring 27 Oren Weimann Lecture 2 March 2, 27 Scribe: Tural Badirkhanli Overview Last lecture we saw how to perform membership quueries in O() time using hashing. Today we

More information

Chapter 3: The Efficiency of Algorithms Invitation to Computer Science,

Chapter 3: The Efficiency of Algorithms Invitation to Computer Science, Chapter 3: The Efficiency of Algorithms Invitation to Computer Science, Objectives In this chapter, you will learn about Attributes of algorithms Measuring efficiency Analysis of algorithms When things

More information

Chapter 3: The Efficiency of Algorithms. Invitation to Computer Science, C++ Version, Third Edition

Chapter 3: The Efficiency of Algorithms. Invitation to Computer Science, C++ Version, Third Edition Chapter 3: The Efficiency of Algorithms Invitation to Computer Science, C++ Version, Third Edition Objectives In this chapter, you will learn about: Attributes of algorithms Measuring efficiency Analysis

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

Chapter 3: The Efficiency of Algorithms

Chapter 3: The Efficiency of Algorithms Chapter 3: The Efficiency of Algorithms Invitation to Computer Science, Java Version, Third Edition Objectives In this chapter, you will learn about Attributes of algorithms Measuring efficiency Analysis

More information

Dynamic Range Majority Data Structures

Dynamic Range Majority Data Structures Dynamic Range Majority Data Structures Amr Elmasry 1, Meng He 2, J. Ian Munro 3, and Patrick K. Nicholson 3 1 Department of Computer Science, University of Copenhagen, Denmark 2 Faculty of Computer Science,

More information

Optimal Parallel Randomized Renaming

Optimal Parallel Randomized Renaming Optimal Parallel Randomized Renaming Martin Farach S. Muthukrishnan September 11, 1995 Abstract We consider the Renaming Problem, a basic processing step in string algorithms, for which we give a simultaneously

More information

The divide and conquer strategy has three basic parts. For a given problem of size n,

The divide and conquer strategy has three basic parts. For a given problem of size n, 1 Divide & Conquer One strategy for designing efficient algorithms is the divide and conquer approach, which is also called, more simply, a recursive approach. The analysis of recursive algorithms often

More information

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Sorting lower bound and Linear-time sorting Date: 9/19/17

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Sorting lower bound and Linear-time sorting Date: 9/19/17 601.433/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Sorting lower bound and Linear-time sorting Date: 9/19/17 5.1 Introduction You should all know a few ways of sorting in O(n log n)

More information

Rotated Library Sort

Rotated Library Sort Rotated Library Sort Franky Lam 1 Raymond K. Wong 1,2 1 School of Computer Science & Engineering University of New South Wales NSW 2052, Australia 2 National ICT Australia, Australia Abstract This paper

More information

Data Streaming Algorithms for Geometric Problems

Data Streaming Algorithms for Geometric Problems Data Streaming Algorithms for Geometric roblems R.Sharathkumar Duke University 1 Introduction A data stream is an ordered sequence of points that can be read only once or a small number of times. Formally,

More information

On the Max Coloring Problem

On the Max Coloring Problem On the Max Coloring Problem Leah Epstein Asaf Levin May 22, 2010 Abstract We consider max coloring on hereditary graph classes. The problem is defined as follows. Given a graph G = (V, E) and positive

More information

Abstract. 1 Introduction

Abstract. 1 Introduction Designing Efficient Distributed Algorithms Using Sampling Techniques S. Rajasekaran and D.S.L. Wei University of Florida and University of Aizu Abstract In this paper we show the power of sampling techniques

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

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

Selection (deterministic & randomized): finding the median in linear time

Selection (deterministic & randomized): finding the median in linear time Lecture 4 Selection (deterministic & randomized): finding the median in linear time 4.1 Overview Given an unsorted array, how quickly can one find the median element? Can one do it more quickly than bysorting?

More information

EECS 2011M: Fundamentals of Data Structures

EECS 2011M: Fundamentals of Data Structures M: Fundamentals of Data Structures Instructor: Suprakash Datta Office : LAS 3043 Course page: http://www.eecs.yorku.ca/course/2011m Also on Moodle Note: Some slides in this lecture are adopted from James

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

Finding the Majority Element in Parallel

Finding the Majority Element in Parallel Finding the Majority Element in Parallel Massimo Cafaro a,b,, Piergiulio Tempesta c, a University of Salento, Lecce, Italy Dept. of Engineering for Innovation - via Per Monteroni, 73100 Lecce, Italy b

More information

10/11/2013. Chapter 3. Objectives. Objectives (continued) Introduction. Attributes of Algorithms. Introduction. The Efficiency of Algorithms

10/11/2013. Chapter 3. Objectives. Objectives (continued) Introduction. Attributes of Algorithms. Introduction. The Efficiency of Algorithms Chapter 3 The Efficiency of Algorithms Objectives INVITATION TO Computer Science 1 After studying this chapter, students will be able to: Describe algorithm attributes and why they are important Explain

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

Binary Search to find item in sorted array

Binary Search to find item in sorted array Binary Search to find item in sorted array January 15, 2008 QUESTION: Suppose we are given a sorted list A[1..n] (as an array), of n real numbers: A[1] A[2] A[n]. Given a real number x, decide whether

More information

Planar Point Location in Sublogarithmic Time

Planar Point Location in Sublogarithmic Time Planar Point Location in Sublogarithmic Time Mihai Pătraşcu (MIT) Point Location in o(log n) Time, Voronoi Diagrams in o(n log n) Time, and Other Transdichotomous Results in Computational Geometry Timothy

More information

Lecture 2 February 4, 2010

Lecture 2 February 4, 2010 6.897: Advanced Data Structures Spring 010 Prof. Erik Demaine Lecture February 4, 010 1 Overview In the last lecture we discussed Binary Search Trees(BST) and introduced them as a model of computation.

More information

Chapter 2: Complexity Analysis

Chapter 2: Complexity Analysis Chapter 2: Complexity Analysis Objectives Looking ahead in this chapter, we ll consider: Computational and Asymptotic Complexity Big-O Notation Properties of the Big-O Notation Ω and Θ Notations Possible

More information

A Distribution-Sensitive Dictionary with Low Space Overhead

A Distribution-Sensitive Dictionary with Low Space Overhead A Distribution-Sensitive Dictionary with Low Space Overhead Prosenjit Bose, John Howat, and Pat Morin School of Computer Science, Carleton University 1125 Colonel By Dr., Ottawa, Ontario, CANADA, K1S 5B6

More information

Module 3: Sorting and Randomized Algorithms

Module 3: Sorting and Randomized Algorithms Module 3: Sorting and Randomized Algorithms CS 240 - Data Structures and Data Management Reza Dorrigiv, Daniel Roche School of Computer Science, University of Waterloo Winter 2010 Reza Dorrigiv, Daniel

More information

Algorithm Analysis. (Algorithm Analysis ) Data Structures and Programming Spring / 48

Algorithm Analysis. (Algorithm Analysis ) Data Structures and Programming Spring / 48 Algorithm Analysis (Algorithm Analysis ) Data Structures and Programming Spring 2018 1 / 48 What is an Algorithm? An algorithm is a clearly specified set of instructions to be followed to solve a problem

More information

Computing intersections in a set of line segments: the Bentley-Ottmann algorithm

Computing intersections in a set of line segments: the Bentley-Ottmann algorithm Computing intersections in a set of line segments: the Bentley-Ottmann algorithm Michiel Smid October 14, 2003 1 Introduction In these notes, we introduce a powerful technique for solving geometric problems.

More information

Multiway Blockwise In-place Merging

Multiway Blockwise In-place Merging Multiway Blockwise In-place Merging Viliam Geffert and Jozef Gajdoš Institute of Computer Science, P.J.Šafárik University, Faculty of Science Jesenná 5, 041 54 Košice, Slovak Republic viliam.geffert@upjs.sk,

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

Flexible Coloring. Xiaozhou Li a, Atri Rudra b, Ram Swaminathan a. Abstract

Flexible Coloring. Xiaozhou Li a, Atri Rudra b, Ram Swaminathan a. Abstract Flexible Coloring Xiaozhou Li a, Atri Rudra b, Ram Swaminathan a a firstname.lastname@hp.com, HP Labs, 1501 Page Mill Road, Palo Alto, CA 94304 b atri@buffalo.edu, Computer Sc. & Engg. dept., SUNY Buffalo,

More information

Module 3: Sorting and Randomized Algorithms. Selection vs. Sorting. Crucial Subroutines. CS Data Structures and Data Management

Module 3: Sorting and Randomized Algorithms. Selection vs. Sorting. Crucial Subroutines. CS Data Structures and Data Management Module 3: Sorting and Randomized Algorithms CS 240 - Data Structures and Data Management Sajed Haque Veronika Irvine Taylor Smith Based on lecture notes by many previous cs240 instructors David R. Cheriton

More information

Module 3: Sorting and Randomized Algorithms

Module 3: Sorting and Randomized Algorithms Module 3: Sorting and Randomized Algorithms CS 240 - Data Structures and Data Management Sajed Haque Veronika Irvine Taylor Smith Based on lecture notes by many previous cs240 instructors David R. Cheriton

More information

0.1 Welcome. 0.2 Insertion sort. Jessica Su (some portions copied from CLRS)

0.1 Welcome. 0.2 Insertion sort. Jessica Su (some portions copied from CLRS) 0.1 Welcome http://cs161.stanford.edu My contact info: Jessica Su, jtysu at stanford dot edu, office hours Monday 3-5 pm in Huang basement TA office hours: Monday, Tuesday, Wednesday 7-9 pm in Huang basement

More information

A Simplied NP-complete MAXSAT Problem. Abstract. It is shown that the MAX2SAT problem is NP-complete even if every variable

A Simplied NP-complete MAXSAT Problem. Abstract. It is shown that the MAX2SAT problem is NP-complete even if every variable A Simplied NP-complete MAXSAT Problem Venkatesh Raman 1, B. Ravikumar 2 and S. Srinivasa Rao 1 1 The Institute of Mathematical Sciences, C. I. T. Campus, Chennai 600 113. India 2 Department of Computer

More information

Path Queries in Weighted Trees

Path Queries in Weighted Trees Path Queries in Weighted Trees Meng He 1, J. Ian Munro 2, and Gelin Zhou 2 1 Faculty of Computer Science, Dalhousie University, Canada. mhe@cs.dal.ca 2 David R. Cheriton School of Computer Science, University

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

Fundamental mathematical techniques reviewed: Mathematical induction Recursion. Typically taught in courses such as Calculus and Discrete Mathematics.

Fundamental mathematical techniques reviewed: Mathematical induction Recursion. Typically taught in courses such as Calculus and Discrete Mathematics. Fundamental mathematical techniques reviewed: Mathematical induction Recursion Typically taught in courses such as Calculus and Discrete Mathematics. Techniques introduced: Divide-and-Conquer Algorithms

More information

Lecture Notes on Karger s Min-Cut Algorithm. Eric Vigoda Georgia Institute of Technology Last updated for Advanced Algorithms, Fall 2013.

Lecture Notes on Karger s Min-Cut Algorithm. Eric Vigoda Georgia Institute of Technology Last updated for Advanced Algorithms, Fall 2013. Lecture Notes on Karger s Min-Cut Algorithm. Eric Vigoda Georgia Institute of Technology Last updated for 4540 - Advanced Algorithms, Fall 2013. Today s topic: Karger s min-cut algorithm [3]. Problem Definition

More information

On Dynamic Range Reporting in One Dimension

On Dynamic Range Reporting in One Dimension On Dynamic Range Reporting in One Dimension Christian Mortensen 1 Rasmus Pagh 1 Mihai Pǎtraşcu 2 1 IT U. Copenhagen 2 MIT STOC May 22, 2005 Range Reporting in 1D Maintain a set S, S = n, under: INSERT(x):

More information

Comp Online Algorithms

Comp Online Algorithms Comp 7720 - Online Algorithms Notes 4: Bin Packing Shahin Kamalli University of Manitoba - Fall 208 December, 208 Introduction Bin packing is one of the fundamental problems in theory of computer science.

More information

Interval Stabbing Problems in Small Integer Ranges

Interval Stabbing Problems in Small Integer Ranges Interval Stabbing Problems in Small Integer Ranges Jens M. Schmidt Freie Universität Berlin, Germany Enhanced version of August 2, 2010 Abstract Given a set I of n intervals, a stabbing query consists

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

Ensures that no such path is more than twice as long as any other, so that the tree is approximately balanced

Ensures that no such path is more than twice as long as any other, so that the tree is approximately balanced 13 Red-Black Trees A red-black tree (RBT) is a BST with one extra bit of storage per node: color, either RED or BLACK Constraining the node colors on any path from the root to a leaf Ensures that no such

More information

Sankalchand Patel College of Engineering - Visnagar Department of Computer Engineering and Information Technology. Assignment

Sankalchand Patel College of Engineering - Visnagar Department of Computer Engineering and Information Technology. Assignment Class: V - CE Sankalchand Patel College of Engineering - Visnagar Department of Computer Engineering and Information Technology Sub: Design and Analysis of Algorithms Analysis of Algorithm: Assignment

More information

Chapter 3. The Efficiency of Algorithms INVITATION TO. Computer Science

Chapter 3. The Efficiency of Algorithms INVITATION TO. Computer Science Chapter 3 The Efficiency of Algorithms INVITATION TO 1 Computer Science Objectives After studying this chapter, students will be able to: Describe algorithm attributes and why they are important Explain

More information

A SIMPLE APPROXIMATION ALGORITHM FOR NONOVERLAPPING LOCAL ALIGNMENTS (WEIGHTED INDEPENDENT SETS OF AXIS PARALLEL RECTANGLES)

A SIMPLE APPROXIMATION ALGORITHM FOR NONOVERLAPPING LOCAL ALIGNMENTS (WEIGHTED INDEPENDENT SETS OF AXIS PARALLEL RECTANGLES) Chapter 1 A SIMPLE APPROXIMATION ALGORITHM FOR NONOVERLAPPING LOCAL ALIGNMENTS (WEIGHTED INDEPENDENT SETS OF AXIS PARALLEL RECTANGLES) Piotr Berman Department of Computer Science & Engineering Pennsylvania

More information

Clustering. (Part 2)

Clustering. (Part 2) Clustering (Part 2) 1 k-means clustering 2 General Observations on k-means clustering In essence, k-means clustering aims at minimizing cluster variance. It is typically used in Euclidean spaces and works

More information

CS264: Homework #1. Due by midnight on Thursday, January 19, 2017

CS264: Homework #1. Due by midnight on Thursday, January 19, 2017 CS264: Homework #1 Due by midnight on Thursday, January 19, 2017 Instructions: (1) Form a group of 1-3 students. You should turn in only one write-up for your entire group. See the course site for submission

More information

Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest. Introduction to Algorithms

Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest. Introduction to Algorithms Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest Introduction to Algorithms Preface xiii 1 Introduction 1 1.1 Algorithms 1 1.2 Analyzing algorithms 6 1.3 Designing algorithms 1 1 1.4 Summary 1 6

More information

Towards ultimate binary heaps

Towards ultimate binary heaps Towards ultimate binary heaps Amr Elmasry 1 Jyrki Katajainen 2 1 Computer and Systems Engineering Department, Alexandria University Alexandria 21544, Egypt 2 Department of Computer Science, University

More information

Scan and its Uses. 1 Scan. 1.1 Contraction CSE341T/CSE549T 09/17/2014. Lecture 8

Scan and its Uses. 1 Scan. 1.1 Contraction CSE341T/CSE549T 09/17/2014. Lecture 8 CSE341T/CSE549T 09/17/2014 Lecture 8 Scan and its Uses 1 Scan Today, we start by learning a very useful primitive. First, lets start by thinking about what other primitives we have learned so far? The

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

Let the dynamic table support the operations TABLE-INSERT and TABLE-DELETE It is convenient to use the load factor ( )

Let the dynamic table support the operations TABLE-INSERT and TABLE-DELETE It is convenient to use the load factor ( ) 17.4 Dynamic tables Let us now study the problem of dynamically expanding and contracting a table We show that the amortized cost of insertion/ deletion is only (1) Though the actual cost of an operation

More information

Poketree: A Dynamically Competitive Data Structure with Good Worst-Case Performance

Poketree: A Dynamically Competitive Data Structure with Good Worst-Case Performance Poketree: A Dynamically Competitive Data Structure with Good Worst-Case Performance Jussi Kujala and Tapio Elomaa Institute of Software Systems Tampere University of Technology P.O. Box 553, FI-33101 Tampere,

More information

CSE 3101: Introduction to the Design and Analysis of Algorithms. Office hours: Wed 4-6 pm (CSEB 3043), or by appointment.

CSE 3101: Introduction to the Design and Analysis of Algorithms. Office hours: Wed 4-6 pm (CSEB 3043), or by appointment. CSE 3101: Introduction to the Design and Analysis of Algorithms Instructor: Suprakash Datta (datta[at]cse.yorku.ca) ext 77875 Lectures: Tues, BC 215, 7 10 PM Office hours: Wed 4-6 pm (CSEB 3043), or by

More information

Quiz 1 Solutions. (a) f(n) = n g(n) = log n Circle all that apply: f = O(g) f = Θ(g) f = Ω(g)

Quiz 1 Solutions. (a) f(n) = n g(n) = log n Circle all that apply: f = O(g) f = Θ(g) f = Ω(g) Introduction to Algorithms March 11, 2009 Massachusetts Institute of Technology 6.006 Spring 2009 Professors Sivan Toledo and Alan Edelman Quiz 1 Solutions Problem 1. Quiz 1 Solutions Asymptotic orders

More information

Online algorithms for clustering problems

Online algorithms for clustering problems University of Szeged Department of Computer Algorithms and Artificial Intelligence Online algorithms for clustering problems Summary of the Ph.D. thesis by Gabriella Divéki Supervisor Dr. Csanád Imreh

More information

arxiv: v2 [cs.ds] 30 Sep 2016

arxiv: v2 [cs.ds] 30 Sep 2016 Synergistic Sorting, MultiSelection and Deferred Data Structures on MultiSets Jérémy Barbay 1, Carlos Ochoa 1, and Srinivasa Rao Satti 2 1 Departamento de Ciencias de la Computación, Universidad de Chile,

More information

Funnel Heap - A Cache Oblivious Priority Queue

Funnel Heap - A Cache Oblivious Priority Queue Alcom-FT Technical Report Series ALCOMFT-TR-02-136 Funnel Heap - A Cache Oblivious Priority Queue Gerth Stølting Brodal, Rolf Fagerberg Abstract The cache oblivious model of computation is a two-level

More information

Divide-and-Conquer. Combine solutions to sub-problems into overall solution. Break up problem of size n into two equal parts of size!n.

Divide-and-Conquer. Combine solutions to sub-problems into overall solution. Break up problem of size n into two equal parts of size!n. Chapter 5 Divide and Conquer Slides by Kevin Wayne. Copyright 25 Pearson-Addon Wesley. All rights reserved. Divide-and-Conquer Divide-and-conquer. Break up problem into several parts. Solve each part recursively.

More information

Advanced Algorithms and Data Structures

Advanced Algorithms and Data Structures Advanced Algorithms and Data Structures Prof. Tapio Elomaa tapio.elomaa@tut.fi Course Prerequisites A seven credit unit course Replaced OHJ-2156 Analysis of Algorithms We take things a bit further than

More information

Plotting run-time graphically. Plotting run-time graphically. CS241 Algorithmics - week 1 review. Prefix Averages - Algorithm #1

Plotting run-time graphically. Plotting run-time graphically. CS241 Algorithmics - week 1 review. Prefix Averages - Algorithm #1 CS241 - week 1 review Special classes of algorithms: logarithmic: O(log n) linear: O(n) quadratic: O(n 2 ) polynomial: O(n k ), k 1 exponential: O(a n ), a > 1 Classifying algorithms is generally done

More information

Geometric Streaming Algorithms with a Sorting Primitive (TR CS )

Geometric Streaming Algorithms with a Sorting Primitive (TR CS ) Geometric Streaming Algorithms with a Sorting Primitive (TR CS-2007-17) Eric Y. Chen School of Computer Science University of Waterloo Waterloo, ON N2L 3G1, Canada, y28chen@cs.uwaterloo.ca Abstract. We

More information

Lecture Notes on Quicksort

Lecture Notes on Quicksort Lecture Notes on Quicksort 15-122: Principles of Imperative Computation Frank Pfenning Lecture 8 February 5, 2015 1 Introduction In this lecture we consider two related algorithms for sorting that achieve

More information

Scan and Quicksort. 1 Scan. 1.1 Contraction CSE341T 09/20/2017. Lecture 7

Scan and Quicksort. 1 Scan. 1.1 Contraction CSE341T 09/20/2017. Lecture 7 CSE341T 09/20/2017 Lecture 7 Scan and Quicksort 1 Scan Scan is a very useful primitive for parallel programming. We will use it all the time in this class. First, lets start by thinking about what other

More information

Maximal Independent Set

Maximal Independent Set Chapter 4 Maximal Independent Set In this chapter we present a first highlight of this course, a fast maximal independent set (MIS) algorithm. The algorithm is the first randomized algorithm that we study

More information

Given a text file, or several text files, how do we search for a query string?

Given a text file, or several text files, how do we search for a query string? CS 840 Fall 2016 Text Search and Succinct Data Structures: Unit 4 Given a text file, or several text files, how do we search for a query string? Note the query/pattern is not of fixed length, unlike key

More information

Formal Model. Figure 1: The target concept T is a subset of the concept S = [0, 1]. The search agent needs to search S for a point in T.

Formal Model. Figure 1: The target concept T is a subset of the concept S = [0, 1]. The search agent needs to search S for a point in T. Although this paper analyzes shaping with respect to its benefits on search problems, the reader should recognize that shaping is often intimately related to reinforcement learning. The objective in reinforcement

More information

Space-efficient algorithms for computing the convex hull of a simple polygonal line in linear time

Space-efficient algorithms for computing the convex hull of a simple polygonal line in linear time Space-efficient algorithms for computing the convex hull of a simple polygonal line in linear time Hervé Brönnimann 1 and Timothy M. Chan 2 1 Computer and Information Science, Polytechnic University, Six

More information

Geometric Unique Set Cover on Unit Disks and Unit Squares

Geometric Unique Set Cover on Unit Disks and Unit Squares CCCG 2016, Vancouver, British Columbia, August 3 5, 2016 Geometric Unique Set Cover on Unit Disks and Unit Squares Saeed Mehrabi Abstract We study the Unique Set Cover problem on unit disks and unit squares.

More information

15-451/651: Design & Analysis of Algorithms November 4, 2015 Lecture #18 last changed: November 22, 2015

15-451/651: Design & Analysis of Algorithms November 4, 2015 Lecture #18 last changed: November 22, 2015 15-451/651: Design & Analysis of Algorithms November 4, 2015 Lecture #18 last changed: November 22, 2015 While we have good algorithms for many optimization problems, the previous lecture showed that many

More information

All-Pairs Nearly 2-Approximate Shortest-Paths in O(n 2 polylog n) Time

All-Pairs Nearly 2-Approximate Shortest-Paths in O(n 2 polylog n) Time All-Pairs Nearly 2-Approximate Shortest-Paths in O(n 2 polylog n) Time Surender Baswana 1, Vishrut Goyal 2, and Sandeep Sen 3 1 Max-Planck-Institut für Informatik, Saarbrücken, Germany. sbaswana@mpi-sb.mpg.de

More information

Algorithms in Systems Engineering IE172. Midterm Review. Dr. Ted Ralphs

Algorithms in Systems Engineering IE172. Midterm Review. Dr. Ted Ralphs Algorithms in Systems Engineering IE172 Midterm Review Dr. Ted Ralphs IE172 Midterm Review 1 Textbook Sections Covered on Midterm Chapters 1-5 IE172 Review: Algorithms and Programming 2 Introduction to

More information

Lecture 8 13 March, 2012

Lecture 8 13 March, 2012 6.851: Advanced Data Structures Spring 2012 Prof. Erik Demaine Lecture 8 13 March, 2012 1 From Last Lectures... In the previous lecture, we discussed the External Memory and Cache Oblivious memory models.

More information

Lecture 12 March 16, 2010

Lecture 12 March 16, 2010 6.851: Advanced Data Structures Spring 010 Prof. Erik Demaine Lecture 1 March 16, 010 1 Overvie In the last lecture e covered the round elimination technique and loer bounds on the static predecessor problem.

More information

Range Mode and Range Median Queries on Lists and Trees

Range Mode and Range Median Queries on Lists and Trees Range Mode and Range Median Queries on Lists and Trees Danny Krizanc 1, Pat Morin 2, and Michiel Smid 2 1 Department of Mathematics and Computer Science, Wesleyan University, Middletown, CT 06459 USA dkrizanc@wesleyan.edu

More information

Three Sorting Algorithms Using Priority Queues

Three Sorting Algorithms Using Priority Queues Three Sorting Algorithms Using Priority Queues Amr Elmasry Computer Science Department Alexandria University Alexandria, Egypt. elmasry@cs.rutgers.edu Abstract. We establish a lower bound of B(n) = n log

More information

Summary of Raptor Codes

Summary of Raptor Codes Summary of Raptor Codes Tracey Ho October 29, 2003 1 Introduction This summary gives an overview of Raptor Codes, the latest class of codes proposed for reliable multicast in the Digital Fountain model.

More information

Lecture 7 Quicksort : Principles of Imperative Computation (Spring 2018) Frank Pfenning

Lecture 7 Quicksort : Principles of Imperative Computation (Spring 2018) Frank Pfenning Lecture 7 Quicksort 15-122: Principles of Imperative Computation (Spring 2018) Frank Pfenning In this lecture we consider two related algorithms for sorting that achieve a much better running time than

More information

Dr. Amotz Bar-Noy s Compendium of Algorithms Problems. Problems, Hints, and Solutions

Dr. Amotz Bar-Noy s Compendium of Algorithms Problems. Problems, Hints, and Solutions Dr. Amotz Bar-Noy s Compendium of Algorithms Problems Problems, Hints, and Solutions Chapter 1 Searching and Sorting Problems 1 1.1 Array with One Missing 1.1.1 Problem Let A = A[1],..., A[n] be an array

More information

Topic: Local Search: Max-Cut, Facility Location Date: 2/13/2007

Topic: Local Search: Max-Cut, Facility Location Date: 2/13/2007 CS880: Approximations Algorithms Scribe: Chi Man Liu Lecturer: Shuchi Chawla Topic: Local Search: Max-Cut, Facility Location Date: 2/3/2007 In previous lectures we saw how dynamic programming could be

More information

An Optimal Algorithm for the Euclidean Bottleneck Full Steiner Tree Problem

An Optimal Algorithm for the Euclidean Bottleneck Full Steiner Tree Problem An Optimal Algorithm for the Euclidean Bottleneck Full Steiner Tree Problem Ahmad Biniaz Anil Maheshwari Michiel Smid September 30, 2013 Abstract Let P and S be two disjoint sets of n and m points in the

More information

Comparing the strength of query types in property testing: The case of testing k-colorability

Comparing the strength of query types in property testing: The case of testing k-colorability Comparing the strength of query types in property testing: The case of testing k-colorability Ido Ben-Eliezer Tali Kaufman Michael Krivelevich Dana Ron Abstract We study the power of four query models

More information

Analyze the obvious algorithm, 5 points Here is the most obvious algorithm for this problem: (LastLargerElement[A[1..n]:

Analyze the obvious algorithm, 5 points Here is the most obvious algorithm for this problem: (LastLargerElement[A[1..n]: CSE 101 Homework 1 Background (Order and Recurrence Relations), correctness proofs, time analysis, and speeding up algorithms with restructuring, preprocessing and data structures. Due Thursday, April

More information

Maximal Monochromatic Geodesics in an Antipodal Coloring of Hypercube

Maximal Monochromatic Geodesics in an Antipodal Coloring of Hypercube Maximal Monochromatic Geodesics in an Antipodal Coloring of Hypercube Kavish Gandhi April 4, 2015 Abstract A geodesic in the hypercube is the shortest possible path between two vertices. Leader and Long

More information

An Efficient Transformation for Klee s Measure Problem in the Streaming Model Abstract Given a stream of rectangles over a discrete space, we consider the problem of computing the total number of distinct

More information

COMPUTING MINIMUM SPANNING TREES WITH UNCERTAINTY

COMPUTING MINIMUM SPANNING TREES WITH UNCERTAINTY Symposium on Theoretical Aspects of Computer Science 2008 (Bordeaux), pp. 277-288 www.stacs-conf.org COMPUTING MINIMUM SPANNING TREES WITH UNCERTAINTY THOMAS ERLEBACH 1, MICHAEL HOFFMANN 1, DANNY KRIZANC

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

CSC 505, Spring 2005 Week 6 Lectures page 1 of 9

CSC 505, Spring 2005 Week 6 Lectures page 1 of 9 CSC 505, Spring 2005 Week 6 Lectures page 1 of 9 Objectives: learn general strategies for problems about order statistics learn how to find the median (or k-th largest) in linear average-case number of

More information

1 The range query problem

1 The range query problem CS268: Geometric Algorithms Handout #12 Design and Analysis Original Handout #12 Stanford University Thursday, 19 May 1994 Original Lecture #12: Thursday, May 19, 1994 Topics: Range Searching with Partition

More information

Unit 7 Number System and Bases. 7.1 Number System. 7.2 Binary Numbers. 7.3 Adding and Subtracting Binary Numbers. 7.4 Multiplying Binary Numbers

Unit 7 Number System and Bases. 7.1 Number System. 7.2 Binary Numbers. 7.3 Adding and Subtracting Binary Numbers. 7.4 Multiplying Binary Numbers Contents STRAND B: Number Theory Unit 7 Number System and Bases Student Text Contents Section 7. Number System 7.2 Binary Numbers 7.3 Adding and Subtracting Binary Numbers 7.4 Multiplying Binary Numbers

More information