Source author record

Amr Elmasry

Explore this author’s publications, collaborators and research topics. This catalog record has not been claimed by its author.

ResearcherUnclaimed source record

Catalog footprint

Research overview

10works
4topics
4close collaborators

Published work

10 publications

preprint2016arXiv

Optimal Prefix Codes with Fewer Distinct Codeword Lengths are Faster to Construct

A new method for constructing minimum-redundancy binary prefix codes is described. Our method does not explicitly build a Huffman tree; instead it uses a property of optimal prefix codes to compute the codeword lengths corresponding to the input weights. Let nn be the number of weights and kk be the number of distinct codeword lengths as produced by the algorithm for the optimum codes. The running time of our algorithm is O(k⋅n)O(k \cdot n). Following our previous work in \cite{be}, no algorithm can possibly construct optimal prefix codes in o(k⋅n)o(k \cdot n) time. When the given weights are presorted our algorithm performs O(9k⋅log⁡2kn)O(9^k \cdot \log^{2k}{n}) comparisons.

preprint2016arXiv

Space-Efficient Plane-Sweep Algorithms

We introduce space-efficient plane-sweep algorithms for basic planar geometric problems. It is assumed that the input is in a read-only array of nn items and that the available workspace is Θ(s)Θ(s) bits, where lg⁡n≤s≤n⋅lg⁡n\lg n \leq s \leq n \cdot \lg n. Three techniques that can be used as general tools in different space-efficient algorithms are introduced and employed within our algorithms. In particular, we give an almost-optimal algorithm for finding the closest pair among a set of nn points that runs in O(n2/s+n⋅lg⁡s)O(n^2/s + n \cdot \lg s) time. We also give a simple algorithm to enumerate the intersections of nn line segments that runs in O((n2/s2/3)⋅lg⁡s+k)O((n^2/s^{2/3}) \cdot \lg s + k) time, where kk is the number of intersections. The counting version can be solved in O((n2/s2/3)⋅lg⁡s)O((n^2/s^{2/3}) \cdot \lg s)~time. When the segments are axis-parallel, we give an O((n2/s)⋅lg⁡4/3s+n4/3⋅lg⁡1/3n)O((n^2/s) \cdot \lg^{4/3} s + n^{4/3} \cdot \lg^{1/3} n)-time algorithm for counting the intersections, and an algorithm for enumerating the intersections that runs in O((n2/s)⋅lg⁡s⋅lg⁡lg⁡s+n⋅lg⁡s+k)O((n^2/s) \cdot \lg s \cdot \lg \lg s + n \cdot \lg s + k) time, where kk is the number of intersections. We finally present an algorithm that runs in O((n2/s+n⋅lg⁡s)⋅(n/s)⋅lg⁡n)O((n^2/s + n \cdot \lg s) \cdot \sqrt{(n/s) \cdot \lg n}) time to calculate Klee's measure of axis-parallel rectangles.

preprint2015arXiv

Memory-Adjustable Navigation Piles with Applications to Sorting and Convex Hulls

We consider space-bounded computations on a random-access machine (RAM) where the input is given on a read-only random-access medium, the output is to be produced to a write-only sequential-access medium, and the available workspace allows random reads and writes but is of limited capacity. The length of the input is NN elements, the length of the output is limited by the computation, and the capacity of the workspace is O(S)O(S) bits for some predetermined parameter SS. We present a state-of-the-art priority queue---called an adjustable navigation pile---for this restricted RAM model. Under some reasonable assumptions, our priority queue supports minimum\mathit{minimum} and insert\mathit{insert} in O(1)O(1) worst-case time and extract\mathit{extract} in O(N/S+lg⁡S)O(N/S + \lg{} S) worst-case time for any S≥lg⁡NS \geq \lg{} N. We show how to use this data structure to sort NN elements and to compute the convex hull of NN points in the two-dimensional Euclidean space in O(N2/S+Nlg⁡S)O(N^2/S + N \lg{} S) worst-case time for any S≥lg⁡NS \geq \lg{} N. Following a known lower bound for the space-time product of any branching program for finding unique elements, both our sorting and convex-hull algorithms are optimal. The adjustable navigation pile has turned out to be useful when designing other space-efficient algorithms, and we expect that it will find its way to yet other applications.

preprint2014arXiv

Selection from read-only memory with limited workspace

Given an unordered array of NN elements drawn from a totally ordered set and an integer kk in the range from 11 to NN, in the classic selection problem the task is to find the kk-th smallest element in the array. We study the complexity of this problem in the space-restricted random-access model: The input array is stored on read-only memory, and the algorithm has access to a limited amount of workspace. We prove that the linear-time prune-and-search algorithm---presented in most textbooks on algorithms---can be modified to use Θ(N)Θ(N) bits instead of Θ(N)Θ(N) words of extra space. Prior to our work, the best known algorithm by Frederickson could perform the task with Θ(N)Θ(N) bits of extra space in O(Nlg⁡∗N)O(N \lg^{*} N) time. Our result separates the space-restricted random-access model and the multi-pass streaming model, since we can surpass the Ω(Nlg⁡∗N)Ω(N \lg^{*} N) lower bound known for the latter model. We also generalize our algorithm for the case when the size of the workspace is Θ(S)Θ(S) bits, where lg⁡3N≤S≤N\lg^3{N} \leq S \leq N. The running time of our generalized algorithm is O(Nlg⁡∗(N/S)+N(lg⁡N)/lg⁡S)O(N \lg^{*}(N/S) + N (\lg N) / \lg{} S), slightly improving over the O(Nlg⁡∗(N(lg⁡N)/S)+N(lg⁡N)/lg⁡S)O(N \lg^{*}(N (\lg N)/S) + N (\lg N) / \lg{} S) bound of Frederickson's algorithm. To obtain the improvements mentioned above, we developed a new data structure, called the wavelet stack, that we use for repeated pruning. We expect the wavelet stack to be a useful tool in other applications as well.

preprint2014arXiv

Strengthened Lazy Heaps: Surpassing the Lower Bounds for Binary Heaps

Let nn denote the number of elements currently in a data structure. An in-place heap is stored in the first nn locations of an array, uses O(1)O(1) extra space, and supports the operations: minimum, insert, and extract-min. We introduce an in-place heap, for which minimum and insert take O(1)O(1) worst-case time, and extract-min takes O(lg⁡n)O(\lg{} n) worst-case time and involves at most lg⁡n+O(1)\lg{} n + O(1) element comparisons. The achieved bounds are optimal to within additive constant terms for the number of element comparisons. In particular, these bounds for both insert and extract-min -and the time bound for insert- surpass the corresponding lower bounds known for binary heaps, though our data structure is similar. In a binary heap, when viewed as a nearly complete binary tree, every node other than the root obeys the heap property, i.e. the element at a node is not smaller than that at its parent. To surpass the lower bound for extract-min, we reinforce a stronger property at the bottom levels of the heap that the element at any right child is not smaller than that at its left sibling. To surpass the lower bound for insert, we buffer insertions and allow O(lg⁡2n)O(\lg^2{} n) nodes to violate heap order in relation to their parents.

preprint2012arXiv

Dynamic Range Majority Data Structures

Given a set PP of coloured points on the real line, we study the problem of answering range αα-majority (or "heavy hitter") queries on PP. More specifically, for a query range QQ, we want to return each colour that is assigned to more than an αα-fraction of the points contained in QQ. We present a new data structure for answering range αα-majority queries on a dynamic set of points, where α∈(0,1)α\in (0,1). Our data structure uses O(n) space, supports queries in O((lg⁡n)/α)O((\lg n) / α) time, and updates in O((lg⁡n)/α)O((\lg n) / α) amortized time. If the coordinates of the points are integers, then the query time can be improved to O(lg⁡n/(αlg⁡lg⁡n)+(lg⁡(1/α))/α))O(\lg n / (α\lg \lg n) + (\lg(1/α))/α)). For constant values of αα, this improved query time matches an existing lower bound, for any data structure with polylogarithmic update time. We also generalize our data structure to handle sets of points in d-dimensions, for d≥2d \ge 2, as well as dynamic arrays, in which each entry is a colour.

preprint2011arXiv

Worst-Case Optimal Priority Queues via Extended Regular Counters

We consider the classical problem of representing a collection of priority queues under the operations \Findmin{}, \Insert{}, \Decrease{}, \Meld{}, \Delete{}, and \Deletemin{}. In the comparison-based model, if the first four operations are to be supported in constant time, the last two operations must take at least logarithmic time. Brodal showed that his worst-case efficient priority queues achieve these worst-case bounds. Unfortunately, this data structure is involved and the time bounds hide large constants. We describe a new variant of the worst-case efficient priority queues that relies on extended regular counters and provides the same asymptotic time and space bounds as the original. Due to the conceptual separation of the operations on regular counters and all other operations, our data structure is simpler and easier to describe and understand. Also, the constants in the time and space bounds are smaller. In addition, we give an implementation of our structure on a pointer machine. For our pointer-machine implementation, \Decrease{} and \Meld{} are asymptotically slower and require O(lg⁡lg⁡n)O(\lg\lg{n}) worst-case time, where nn denotes the number of elements stored in the resulting priority queue.

preprint2010arXiv

Priority Queues with Multiple Time Fingers

A priority queue is presented that supports the operations insert and find-min in worst-case constant time, and delete and delete-min on element x in worst-case O(lg(min{w_x, q_x}+2)) time, where w_x (respectively q_x) is the number of elements inserted after x (respectively before x) and are still present at the time of the deletion of x. Our priority queue then has both the working-set and the queueish properties, and more strongly it satisfies these properties in the worst-case sense. We also define a new distribution-sensitive property---the time-finger property, which encapsulates and generalizes both the working-set and queueish properties, and present a priority queue that satisfies this property. In addition, we prove a strong implication that the working-set property is equivalent to the unified bound (which is the minimum per operation among the static finger, static optimality, and the working-set bounds). This latter result is of tremendous interest by itself as it had gone unnoticed since the introduction of such bounds by Sleater and Tarjan [JACM 1985]. Accordingly, our priority queue satisfies other distribution-sensitive properties as the static finger, static optimality, and the unified bound.

preprint2010arXiv

The Violation Heap: A Relaxed Fibonacci-Like Heap

We give a priority queue that achieves the same amortized bounds as Fibonacci heaps. Namely, find-min requires O(1) worst-case time, insert, meld and decrease-key require O(1) amortized time, and delete-min requires O(log⁡n)O(\log n) amortized time. Our structure is simple and promises an efficient practical behavior when compared to other known Fibonacci-like heaps. The main idea behind our construction is to propagate rank updates instead of performing cascaded cuts following a decrease-key operation, allowing for a relaxed structure.

Research graph

See the researcher in context

Open full explorer

Inspect adjacent papers, topics, institutions and collaborators without losing the researcher page.

Building this map preview

BZPEER is loading the nearby papers, people, topics and institutions for this page.