Amr Elmasry

Amr Elmasry
Alexandria University | AU · Department of Computer Engineering and Systems

PhD

About

109
Publications
30,648
Reads
How we measure 'reads'
A 'read' is counted each time someone views a publication summary (such as the title, abstract, and list of authors), clicks on a figure, or views or downloads the full-text. Learn more
662
Citations
Citations since 2017
10 Research Items
224 Citations
201720182019202020212022202301020304050
201720182019202020212022202301020304050
201720182019202020212022202301020304050
201720182019202020212022202301020304050
Additional affiliations
September 2012 - present
Alexandria University
Position
  • Professor
September 2010 - August 2012
University of Copenhagen
Position
  • Professor
September 2008 - August 2010
Max Planck Institute for Informatics
Position
  • Researcher

Publications

Publications (109)
Article
Full-text available
We formalize several regular numeral systems, state their properties and supported operations, clarify the correctness, and tabulate the proofs. Our goal is to use as few symbols in the presentation of digits and make as few digit changes as possible in every operation. Most importantly, we introduce two new systems: (1) the buffered regular system...
Article
Full-text available
We show how a few modifications to the red-black trees allow for $O(1)$ worst-case update time (once the position of the inserted or deleted element is known). The resulting structure is based on relaxing some of the properties of the red-black trees while guaranteeing that the height remains logarithmic with respect to the number of nodes. Compare...
Preprint
In this paper we give a single-source shortest-path algorithm that breaks, after over 60 years, the $O(n \cdot m)$ time bound for the Bellman-Ford algorithm, where $n$ is the number of vertices and $m$ is the number of arcs of the graph. Our algorithm converts the input graph to a graph with nonnegative weights by performing at most $\min(\sqrt{n},...
Article
Full-text available
We give a variant of the pairing heaps that achieves the following amortized costs: O(1) per find-min and insert, O(log log n) per decrease-key and meld, O(log n) per delete-min; where n is the number of elements in the resulting heap on which the operation is performed. These bounds are the best known for any self-adjusting heap and match two lowe...
Article
In the Maximum Interval Constrained Coloring problem, we are given a set of vertices and a set of intervals on a line and a k-dimensional requirement vector for each interval, specifying how many vertices of each of k colors should appear in the interval. The objective is to color the vertices of the line with k colors so as to maximize the total w...
Article
Full-text available
We describe a heap data structure that supports Minimum, Insert, and Borrow at O(1) worst-case cost, Delete at O(lgn) worst-case cost including at most lgn + O(1) element comparisons, and Union at O(lgn) worst-case cost including at most lgn + O(lglgn) element comparisons, where n denotes the (total) number of elements stored in the data structure(...
Article
Full-text available
We study the problem of constructing a binary heap in an array using only a small amount of additional space. Let N denote the size of the input, M the capacity of the cache, and B the width of the cache lines of the underlying computer, all measured as numbers of elements. We show that there exists an in-place heap-construction algorithm that runs...
Article
Given a set of n coloured points on the real line, we study the problem of answering range α-majority (or “heavy hitter”) queries on . More specifically, for a query range , we want to return each colour that is assigned to more than an α-fraction of the points contained in . We present a new data structure for answering range α-majority queries on...
Conference Paper
Control-flow dependence has always been posited as a substantial dilemma against program acceleration. With the availability of instruction-level parallel architectures, if-conversion optimization has become pivotal for extracting parallelism from serial programs. While many if-conversion optimization heuristics have been proposed in the literature...
Article
Full-text available
The authors regret that the published version of the above article is incorrect. The correct and final version follows. The authors would like to apologise for any inconvenience caused.
Article
Full-text available
Power consumption is a very important issue when it comes to embedded devices, therefore every processing cycle should be optimally utilized and considered. In speculated execution, highly mispredicted branches are considered a critical threat for both time and power saving. In this paper, we show that, for a specific branch, misprediction rate of...
Article
Full-text available
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 $N$ elements, the length of the...
Conference Paper
Full-text available
An in-place priority queue is a data structure that is stored in an array, uses constant extra space in addition to the array elements, and supports the operations \( top \) (\( find \)-\( min \)), \( push \) (\( insert \)), and \( pop \) (\( delete \)-\( min \)). In this paper we introduce an in-place priority queue, for which \( top \) and \( pus...
Article
Full-text available
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 n items and that the available workspace is $\Theta(s)$ bits, where $\lg n \leq s \leq n \cdot \lg n$. In particular, we give an almost-optimal algorithm for finding the closest pair among a set of $n$ poi...
Conference Paper
Full-text available
An \emph{in-place} \emph{priority queue} is a data structure that is stored in an array, uses constant extra space in addition to the array elements, and supports the operations \Minimum{} FindMin{}, Insert, and Extractmin. In this paper we introduce an in-place priority queue, for which Minimum and Insert take $O(1)$ worst-case time, and Extractmi...
Conference Paper
Full-text available
We reconsider basic algorithmic graph problems in a setting where an n-vertex input graph is read-only and the computation must take place in a working memory of O(n) bits or little more than that. For computing connected components and performing breadth-first search, we match the running times of standard algorithms that have no memory restrictio...
Article
Consider a sequence X of n elements, where the number of inversions in X is Inv. We give a simple linear-time transformation that reduces the problem of counting the inversions in X to that of counting inversions within disjoint subsequences of X of O(1 + (Inv/n)(2)) elements each. In accordance, we can apply our transformation for counting inversi...
Conference Paper
Full-text available
We revisit the read-only random-access model, in which the input array is read-only and a limited amount of workspace is allowed. Given a set of N two-dimensional points in a read-only input array and Θ(S) bits of extra workspace (where \(S \geq \lg N\)), we present an algorithm that runs in \(O(N^2/S + N \lg S)\) time for constructing the convex h...
Article
Full-text available
Let $n$ denote the number of elements currently in a data structure. An in-place heap is stored in the first $n$ locations of an array, uses $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)$ worst-case time, and extract-min takes $O(\lg{} n)$ wo...
Conference Paper
Given an unordered array of $N$ elements drawn from a totally ordered set and an integer $k$ in the range from $1$ to $N$, in the classic selection problem the task is to find the $k$-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,...
Article
Full-text available
We present algorithms that construct a sparse spanning subgraph of a three-edge-connected graph that preserves three-edge connectivity or of a three-vertex-connected graph that preserves three-vertex connectivity. Our algorithms are conceptually simple and run in O(|E|) time. These simple algorithms can be used to improve the efficiency of the best...
Article
A weak heap is a priority queue that supports the operations construct, minimum, insert, and extract-minextract-min. To store n elements, it uses an array of n elements and an array of n bits. In this paper we study different possibilities for optimizing construct and insert such that minimum and extract-minextract-min are not made slower. We provi...
Conference Paper
Full-text available
We introduce a binary counter that supports increments and decrements in O(1) worst-case time per operation. (We assume that arithmetic operations on an index variable that is stored in one computer word can be performed in O(1) time each.) To represent any integer in the range from 0 to 2n − 1, our counter uses an array of at most n bits plus few...
Conference Paper
Full-text available
A weak heap is a variant of a binary heap where, for each node, the heap ordering is enforced only for one of its two children. In 1993, Dutton showed that this data structure yields a simple worst-case-efficient sorting algorithm. In this paper we review the refinements proposed to the basic data structure that improve the efficiency even further....
Conference Paper
Full-text available
It was reported in a study by Brodal and Moruz that, due to branch mispredictions, skewed search trees may perform better than perfectly balanced search trees. In this paper we take the search procedures under microscopic examination, and show that perfectly balanced search trees—when programmed carefully—are better than skewed search trees. As in...
Article
Full-text available
In this paper new dependencies are added to the hierarchy of the distribution-sensitive properties for data structures. Most remarkably, we prove that the working-set property is equivalent to the unified-bound property; a fact that had gone unnoticed since the introduction of such bounds in the Eighties by Sleator and Tarjan.
Article
Full-text available
We introduce a variant of fat heaps that does not rely on regular counters, and still achieves the optimal worst-case bounds: O(1) for find-min, insert and decrease, and O(log n) for delete and delete-min. Compared to the original, our variant is simpler to explain, more efficient, and easier to implement. Experimental results suggest that our impl...
Conference Paper
Full-text available
We revisit the random-access-machine model in which the input is given on a read-only random-access media, the output is to be produced to a write-only sequential-access media, and in addition there is a limited random-access workspace. The length of the input is N elements, the length of the output is limited by the computation itself, and the cap...
Article
Tutte proved that every 3-connected graph G on more than 4 vertices contains a contractible edge. We strengthen this result by showing that every depth-first-search tree of G contains a contractible edge. Moreover, we show that every spanning tree of G contains a contractible edge if G is 3-regular or if G does not contain two disjoint pairs of adj...
Article
Consider a set P of n points in the plane each associated with one of a constant number of colours. We give an output-sensitive algorithm that runs in O(n+|T|) time to enumerate the set of triangles T, such that each triangle contains the origin, its vertices are in P and have three distinct colours.
Conference Paper
Full-text available
In this paper we deal with compressed integer arrays that are equipped with fast random access. Our treatment improves over an earlier approach that used address-calculation coding to locate the elements and supported access and search operations in time for a sequence of n non-negative integers summing up to s . The idea is to complement the addre...
Article
The weak heap is a priority queue that was introduced as a competitive structure for sorting. Its array-based form supports the operations find-min in O(1) worst-case time, and insert and delete-min in O(lgn) worst-case time using at most ⌈lgn⌉ element comparisons. Additionally, its pointer-based form supports delete and decrease in O(lgn) worst-ca...
Article
We present a priority queue that supports insert in worst-case constant time, and delete-min, access-min, delete, and decrease of an element x in worst-case O(log(min{wx,qx}))O(log(min{wx,qx})) time, where wxwx (respectively, qxqx) is the number of elements that were accessed after (respectively, before) the last access to x and are still in the pr...
Conference Paper
Full-text available
We show how to build a binary heap in-place in linear time by performing ˜ 1.625n element comparisons, at most ˜ 2.125n element moves, and ˜ n/B cache misses, where n is the size of the input array, B the capacity of the cache line, and ˜ f(n) approaches f(n) as n grows. The same bound for element comparisons was derived and conjectured to be optim...
Conference Paper
Full-text available
An array-based weak heap is an efficient data structure for realizing an elementary priority queue. In this paper we focus on the construction of a weak heap. Starting from a straightforward algorithm, we end up with a catalogue of algorithms that optimize the standard algorithm in different ways. As the optimization criteria, we consider how to re...
Conference Paper
Full-text available
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...
Article
Given a family of k sets with cardinalities s1,s2,…,sks1,s2,…,sk and N=∑i=1ksi, we show that the size of the partial order graph induced by the subset relation (called the subset graph) is O(∑si⩽B2si+N/lgN⋅∑si>Blg(si/B)),2 where B=lg(N/lg2N)B=lg(N/lg2N). This implies a simpler proof to the O(N2/lg2N) bound concluded in Pritchard (1999) [4].
Conference Paper
Full-text available
In quicksort, due to branch mispredictions, a skewed pivot-selection strategy can lead to a better performance than the exact-median pivot-selection strategy, even if the exact median is given for free. In this paper we investigate the effect of branch mispredictions on the behaviour of mergesort. By decoupling element comparisons from branches, we...
Conference Paper
Full-text available
According to a folk theorem, every program can be trans-formed into a program that produces the same output and only has one loop. We generalize this to a form where the resulting program has one loop and no other branches than the one associated with the loop con-trol. For this branch, branch prediction is easy even for a static branch predictor....
Article
Full-text available
A graph is triconnected if it is connected, has at least 4 vertices and the removal of any two vertices does not disconnect the graph. We give a certifying algorithm deciding triconnectivity of Hamiltonian graphs with linear running time (this assumes that the cycle is given as part of the input). If the input graph is triconnected, the algorithm c...
Conference Paper
Full-text available
We introduce a variant of fat heaps that does not rely on regular counters, and still achieves the optimal worst-case bounds: O(1) for find-min, insert and decrease, and O(lgn) for delete and delete-min. Our variant is simpler to explain, more efficient, and easier to implement. Experimental results suggest that our implementation is superior to st...
Conference Paper
Full-text available
In typical applications, a priority queue is used to execute a sequence of n insert, m decrease, and n delete-min operations, starting with an empty structure. We study the performance of different priority queues for this type of operation sequences both theoretically and experimentally. In particular, we focus on weak heaps, weak queues, and thei...
Conference Paper
Full-text available
Given a set $P$ of coloured points on the real line, we study the problem of answering range $\alpha$-majority (or "heavy hitter") queries on $P$. More specifically, for a query range $Q$, we want to return each colour that is assigned to more than an $\alpha$-fraction of the points contained in $Q$. We present a new data structure for answering ra...
Article
Full-text available
We show that finding the simplices containing a fixed given point among those defined on a set of n points can be done in O(n + k) time for the two-dimensional case, and in O(n ² + k) time for the three-dimensional case, where k is the number of these simplices. As a byproduct, we give an alternative (to the algorithm in Ref. 4) O(n log r) algorith...
Conference Paper
Full-text available
We present a priority queue that supports the operations: insert in worst-case constant time, and delete, delete-min, find-min and decrease-key on an 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 that were accessed after (respectively, before) the last access of x and are still...
Conference Paper
Full-text available
In this paper we introduce two efficient priority queues. For both, insert requires O(1) amortized time and extract-min \(O(\lg n)\) worst-case time including at most \(\lg n + O(1)\) element comparisons, where n is the number of elements stored. One priority queue is based on a weak heap (array-based) and the other on a weak queue (pointer-based)....
Article
Radix Sort is a sorting algorithm based on analyzing digital data. We study the number of swaps made by Radix Select (a one-sided version of Radix Sort) to find an element with a randomly selected rank. This kind of grand average provides a smoothing over all individual distributions for specific fixed-order statistics. We give an exact analysis fo...
Article
Full-text available
Radix Sort is a sorting algorithm based on analyzing digital data. We study the number of swaps made by Radix Select (a one-sided version of Radix Sort) to find an element with a randomly selected rank. This kind of grand average provides a smoothing over all individual distributions for spe-cific fixed order statistics. We give an exact analysis f...
Article
Full-text available
We introduce two numeral systems, the magical skew system and the regular skew system, and contribute to their theory development. For both systems, increments and decrements are supported using a constant number of digit changes per operation. Moreover, for the regular skew system, the operation of adding two numbers is supported efficiently. Our...
Conference Paper
Full-text available
Given an undirected 3-connected graph G with n vertices and m edges, we modify depth-first search to produce a sparse spanning subgraph with at most 4n − 10 edges that is still 3-connected. If G is 2-connected, to maintain 2-connectivity, the resulting graph will have at most 2n − 3 edges. The way depth-first search discards irrelevant edges illust...
Conference Paper
Full-text available
In the Maximum Interval Constrained Coloring problem, we are given a set of intervals on a line and a k-dimensional requirement vector for each interval, specifying how many vertices of each of k colors should appear in the interval. The objective is to color the vertices of the line with k colors so as to maximize the total weight of intervals for...
Conference Paper
Full-text available
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)$ amortized time. Our structure is simple and promises an efficient practical behavior when compared to other known Fibonacc...
Article
Full-text available
Fredman et al. have shown that the amortized cost for deleting the item with the minimum value from a pairing heap is O(√n), no matter how the pairing is done [M. Fredman, R. Sedgewick, D. Sleator, and R. Tarjan, The Pairing heap: a new form of self-adjusting heap, Algorithmica 1(1) (1986), pp. 111–129]. In this paper, this upper bound is shown to...
Article
Full-text available
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 prio...
Conference Paper
Full-text available
Improving the structure and analysis in \cite{elm0}, we give a variation of the pairing heaps that has amortized zero cost per meld (compared to an $O(\log \log{n})$ in \cite{elm0}) and the same amortized bounds for all other operations. More precisely, the new pairing heap requires: no cost per meld, O(1) per find-min and insert, $O(\log{n})$ per...
Conference Paper
Given a sequence of n elements, we introduce the notion of an almost-increasing subsequence in two contexts. The first notion is the longest subsequence that can be converted to an increasing subsequence by possibly adding a value, that is at most a fixed constant c, to each of the elements. We show how to optimally construct such subsequence in O(...
Conference Paper
Full-text available
We introduce a new number system that we call the strictly-regular system, which efficiently supports the operations: digit-increment, digit-decrement, cut, concatenate, and add. Compared to other number systems, the strictly-regular system has distinguishable properties. It is superior to the regular system for its efficient support to decrements,...
Conference Paper
Full-text available
We introduce a new number system that supports increments with a constant number of digit changes. We also give a simple method that extends any number system supporting increments to support decrements using the same number of digit changes. In the new number system the weight of the ith digit is 2 i − 1, and hence we can implement a priority queu...
Conference Paper
Given a family F of k sets with cardinalities s1, s2, . . . , sk and N = P k i=1 si, we show that the size of the partial order graph induced by the subset relation (called the subset
Article
Full-text available
In the Maximum Interval Constrained Coloring problem , we are given a set of intervals on a line and a k-dimensional requirement vector for each interval, specifying how many vertices of each of k colors should appear in the interval. The objective is to color the vertices of the line with k colors so as to maximize the total weight of intervals fo...
Article
We give an algorithm to compute the subset partial order (called the subset graph) for a family F of sets containing k sets with N elements in total and domain size n. Our algorithm requires O(nk2/logk) time and space on a Pointer Machine. When F is dense, i.e. N=Θ(nk), the algorithm requires O(N2/log2N) time and space. We give a construction for a...
Article
Full-text available
We give a variation of the pairing heaps for which the time bounds for all the operations match the lower bound proved by Fredman for a family of similar self-adjusting heaps. Namely, our heap structure requires $O(1)$ for insert and find-min, $O(\log{n})$ for delete-min, and $O(\log\log{n})$ for decrease-key and meld (all the bounds are in the amo...
Conference Paper
Full-text available
Article
Full-text available
We introduce two data-structural transformations to construct double-ended priority queues from priority queues. To apply our transformations the priority queues exploited must support the extraction of an unspecified element, in addition to the standard priority-queue operations. With the first transformation we obtain a double-ended priority queu...
Article
Full-text available
We introduce a framework for reducing the number of element comparisons performed in priority-queue operations. In particular, we give a priority queue which guarantees the worst-case cost of $O(1)$ per minimum finding and insertion, and the worst-case cost of $O(\log n)$ with at most $\log n + O(1)$ element comparisons per minimum deletion and del...
Conference Paper
Full-text available
We introduce an adaptation of run-relaxed heaps which provides efficient heap operations with respect to the number of element comparisons performed. Our data structure guarantees the worst-case cost of O(1) for find–min, insert, and decrease; and the worst-case cost of O(lg n) with at most lg n + 3 lg lg n + O(1) element comparisons for delete, im...
Article
Full-text available
We present two algorithms that are near optimal with respect to the number of inversions present in the input. One of the algorithms is a variation of insertion sort, and the other is a variation of merge sort. The number of comparisons performed by our algorithms, on an input sequence of length n that has I inversions, is at most $$n\,{\rm log}_{2...
Article
Full-text available
We study the performance of the most practical inversion-sensitive internal sorting algorithms. Experimental results illustrate that adaptive AVL sort consumes the fewest number of comparisons unless the number of inversions is less than 1%; in such case Splaysort consumes the fewest number of comparisons. On the other hand, the running time...
Article
Full-text available
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)$ amortized time. Our structure is simple and promises a more efficient practical behavior compared to any other known F...
Conference Paper
Full-text available
Consider a set of n points in K2, each colored either red or blue. A line segment defined by two red points is a red segment, and that defined by two blue points is a blue segment. A bichromatic intersection is an intersection between a red segment and a blue segment. We give an O(n 2 + k) algorithm that reports k bichromatic intersections defined...
Conference Paper
Full-text available
We give a priority queue that guarantees the worst- case cost of (1) per minimum nding, insertion, and decrease; and the worst-case cost of (lg n) with at most lg n + O( p lg n) element comparisons per dele- tion. Here, n denotes the number of elements stored in the data structure prior to the operation in ques- tion, and lg n is a shorthand for ma...
Article
Full-text available
A new priority queue is introduced, for which the cost to insert a new item is constant and the cost to delete the item x with the minimum value is O(logk x ), where k x , is the number of items that are inserted after x and are still in the heap when x is deleted. We achieve the above bounds in both the amortized case and the worst case.
Article
Full-text available
We show that verifying a given prefix code for optimality requires Ω(nlogn) time, indicating that the verification problem is not asymptotically easier than the construction problem. Alternatively, we give linear-time verification algorithms for several special cases that are either typical in practice or theoretically interesting.
Conference Paper
Full-text available
A new method for constructing minimum-redundancy prefix codes is described. This method does not build a Huffman tree; instead it uses a property of optimal codes to find the codeword length of each weight. The running time of the algorithm is shown to be O(nk), where n is the number of weights and k is the number of different codeword lengths. Whe...
Article
Full-text available
Two new ways of transforming a priority queue into a double-ended priority queue are introduced. These methods can be used to improve all known bounds for the comparison complexity of double-ended priority-queue operations. Using an efficient priority queue, the first transformation can produce a double- ended priority queue which guarantees the wo...
Article
Full-text available
A new method for constructing minimum-redundancy prefix codes is described. This method does not explicitly build a Huffman tree; instead it uses a property of optimal codes to find the codeword length of each weight. The running time of the algorithm is shown to be $O(n k)$, which is asymptotically faster than Huffman's algorithm when $k=o(\log{n}...
Conference Paper
Full-text available
Given a set of n points S ⊆ ℜ2, a specified point Z ∈ ℜ2, it is shown that finding k minimal simplices from S, each of which contains Z, can be done in O(n+k) time. It is also shown that counting the number of all such simplices can be done in O(n + nlog(k/n + 1)) time, when the number of simplices is k.
Conference Paper
Full-text available
We study the performance of the most practical internal adaptive sorting algorithms. Experimental results show that adaptive AVL sort performs the least number of comparisons unless the number of inversions is fewer than 1%. In such case, Splaysort performs the fewest number of comparisons. On the other hand, the running time of Quicksort is superi...
Article
Full-text available
We consider the problem of indexing a set of objects moving in d-dimensional spaces along linear trajectories. A simple external-memory indexing scheme is proposed to efficiently answer general range queries. The following are examples of the queries that can be answered by the proposed method: report all moving objects that will (i) pass between t...
Conference Paper
Full-text available
A new method for constructing minimum-redundancy prefix codes is described. This method does not build a Huffman tree; instead it uses a property of optimal codes to find the codeword length of each weight. The running time of the algorithm is shown to be O(nk), where n is the number of weights and k is the number of different codeword lengths. Whe...
Article
Full-text available
We give a deterministic version of the randomized jumplists recently introduced by Brönnimann et al. [2003]. The new structure supports searches in worst-case logarithmic time, insertions and deletions in amortized logarithmic time (versus expected logarithmic time for the randomized version), and the successor of an element can be accessed in wors...
Conference Paper
Full-text available
Summary form only given. Consider the scenario in which a start-up communication company charges its network users by the cost of the minimum spanning tree (MST) they use in their protocols. Wanting to increase their profits, they aim at maximizing the cost of the MST of their network. We consider two different cases. In the first case, the company...
Conference Paper
Full-text available