
This paper investigates how to improve the worst case runtime of Insertion Sort while keeping it in-place, incremental and adaptive. To sort an array of n elements with w bits for each element, classic Insertion Sort runs in O(n2) operations with wn bits space. Gapped Insertion Sort has a runtime of O(n lg n) with a high probability of only using (1 + e)wn bits space. This paper shows that Rotated Insertion Sort guarantees O(√n lg n) operations per insertion and has a worst case sorting time of O(n1.5 lg n) operations by using optimal O(w) auxiliary bits. By using extra Θ(√n lg n) bits and recursively applying the same structure l times, it can be done with O(2l n1+1/l) operations. Apart from the space usage and time guarantees, it also has the advantage of efficiently retrieving the i-th element in constant time. This paper presents Rotated Library Sort that combines the advantages of the above two improved approaches.
The busy beaver problem is to find the maximum number of non-zero characters that can be printed by an n-state Turing machine of a particular type. A critical step in the solution of this problem is to determine whether or not a given n-state Turing machine halts on a blank input. Given the enormous output sizes that can be produced by some small machines, it becomes critical to have appropriate methods for dealing with the exponential behaviour of both terminating and non-terminating machines. In this paper, we investigate a heuristic which can be used to greatly accelerate execution of this class of machines. This heuristic, which we call the observant otter, is based on the detection of patterns earlier in the execution trace. We describe our implementation of this method and report various experimental results based on it, including showing how it can be used to evaluate all known 'monster' machines, including some whose naive execution would take around 1036,534 steps.
Let S be a set of n points in the plane. We present data structures that solve range-aggregate query problems on three geometric extent measure problems. Using these data structures, we can report, for any axis-parallel query rectangle Q, the area/perimeter of the convex hull, the width, and the radius of the smallest enclosing disk of the points in S ∩ Q.
We consider online job scheduling together with power management on multiple machines. In this model, jobs with arbitrary sizes and weights arrive online, and each machine consumes different amount of energy when it is processing a job, idling or sleeping. A scheduler has to maintain a good balance of the states of the machines to avoid energy wastage, while giving an efficient schedule of the jobs. We consider a recently well-studied objective of minimizing the total weighted flow time of the jobs plus the total energy usage. For the special case where all jobs have the same weight, competitive algorithms have been obtained (Lam et al. 2009, Chan et al. 2011). This paper gives a non-trivial potential analysis of a weighted generalization of the power management algorithm in (Chan et al. 2011), coupled with a classic scheduling algorithm HDF. This leads to the first competitive result for minimizing weighted flow time plus energy. The result can be extended to the dynamic speed scaling model where the scheduler can vary the speed of individual machines to process the jobs and the energy usage depends on the speed of the machines.
We develop a new method for proving explicit approximation lower bounds for the Shortest Superstring problem, the Maximum Compression problem, the Maximum Asymmetric TSP problem, the (1, 2)--ATSP problem and the (1, 2)--TSP problem improving on the best known approximation lower bounds for those problems.
Let C be a logic circuit consisting of s gates g 1 , g 2 ,..., g s , then the output pattern of C for an input x ε {0, 1} n is defined to be a vector ( g 1 ( x ), g 2 ( x ),..., g s ( x )) ∈ {0, 1} s of the outputs of g 1 , g 2 ,..., g s for x . For each f : {0, 1} 2 → {0, 1}, we define an f -circuit as a logic circuit where every gate computes f , and investigate computational complexity of the following counting problem: Given an f -circuit C , how many output patterns arise in C ? We then provide a dichotomy result on the counting problem: We prove that the problem is solvable in polynomial time if f is PARITY or any degenerate function, while the problem is #P-complete even for constant-depth f -circuits if f is one of the other functions, such as AND, OR, NAND and NOR.
Given an edge-weighted undirected graph and two vertices s and t, the next-to-shortest path problem is to find an st-path whose length is minimum among all st-paths of lengths strictly larger than the shortest path length. The problem is shown to be polynomially solvable if all edge weights are positive, while the complexity status for the nonnegative weight case was open. In this paper we show that the problem in undirected graphs admits a polynomial-time algorithm even if all edge weights are nonnegative, solving the open problem. To solve the problem, we introduce a common generalization of the undirected graph version and the acyclic digraph version of the k vertex-disjoint paths problem.
Given a graph G = (V, E) and an integer D ≥ 1, we consider the problem of augmenting G by a minimum set of new edges so that the diameter becomes at most D. It is known that no constant factor approximation algorithms to this problem with an arbitrary graph G can be obtained unless P = NP, while the problem with only a few graph classes such as forests is approximable within a constant factor. In this paper, we give the first constant factor approximation algorithm to the problem with an outerplanar graph G. We also show that if the target diameter D is even, then the case where G is a partial 2-tree is also approximable within a constant.
This paper considers the problem of finding the cost of a quickest path between two points in the Euclidean plane in the presence of a transportation network. A transportation network consists of a planar network where each road (edge) has an individual speed. A traveler may enter and exit the network at any point on the roads. Along any road the traveler moves with a fixed speed depending on the road, and outside the network the traveler moves at unit speed in any direction.We show how the transportation network with n edges in the Euclidean plane can be preprocessed in time O((nε)2logn) into a data structure of size O((nε)2) such that (1+ε)-approximate quickest path cost queries between any two points in the plane can be answered in time O(1ε4logn).In addition we consider the nearest neighbor problem in a transportation network: given a transportation network with n edges in the Euclidean plane together with a set Z of m sites, a query point q∈R2, find the nearest site in Z from q. We show how the transportation network can be preprocessed in time O((n2+nm)log(n+m)) such that (1+ε)-nearest neighbor query can be answered in time O(1ε2log(n+m)).
A linear-time algorithm for decomposing a graph into split components is presented. The algorithm uses a new graph transformation technique to gradually transform the given graph so that every split component in it is transformed into a subgraph with very simple structure which can be easily identified. Once the split components are determined, the triconnected components of the graph are easily determined. The algorithm is conceptually simple and makes one less pass over the input graph than the existing best known algorithm which could mean substantial saving in actual execution time. The new graph transformation technique may be useful in other context.
We revisit the problem of counting paths in width-2 planar branching programs. We show that this is hard for Boolean NC1 under ACC0[5] reductions, completing a proof strategy outlined in [3]. On the other hand, for several restricted instances of width-2 planar branching programs, we show that the counting problem is TC0-complete. We also show that non-planar width-2 programs can be planarized in AC0[2]. Using the equivalence of planar width-2 programs with the reduced-form representation of positive rationals, we show that the evaluation problem for this representation in the Stern-Brocot tree is also NC1 hard. In contrast, the evaluation problem in the continued fraction representation is in TC0.
This paper is about: (1) bounds on the number of cliques in a graph in a particular class, and (2) algorithms for listing all cliques in a graph. We present a simple algorithm that lists all cliques in an n-vertex graph in O(n) time per clique. For O(1)-degenerate graphs, such as graphs excluding a fixed minor, we describe a O(n) time algorithm for listing all cliques. We prove that graphs excluding a fixed odd-minor have O(n2) cliques (which is tight), and conclude a O(n3) time algorithm for listing all cliques.
Given an undirected graph G = (V, E), a graph orientation problem is to decide a direction for each edge so that the resulting directed graph G = (V, Λ (E)) satisfies a certain condition, where Λ(E) is a set of assignments of a direction to each edge {u, v} e E. Among many conceivable types of conditions, we consider a degree constrained orientation: Given positive integers av and bv for each v (av ≤ bv), decide an orientation of G so that av ≤ |{(v, u) e Λ(E)}| ≤ bv holds for every v e V. However, such an orientation does not always exist. In this case, it is desirable to find an orientation that best fits the condition instead. In this paper, we consider the problem of finding an orientation that minimizes ΣveV cv, where cv is a penalty incurred for v's violating the degree constraint. As penalty functions, several classes of functions can be considered, e. g., linear functions, convex functions and concave functions. We show that the degree-constrained orientation with any convex (including linear) penalty function can be solved in O(m1.5 min{Δ0.5, log(nC)}), where n = |V|, m = |E|, Δ and C are the maximum degree and the largest magnitude of a penalty, respectively. In contrast, it has no polynomial approximation algorithm whose approximation factor is better than 1.3606, for concave penalty functions, unless P=NP; it is APX-hard. This holds even for step functions, which are considered concave. For trees, the problem with any penalty functions can be solved exactly in O(n log Δ) time, and if the penalty function is convex, it is solvable in linear time.
We study the computational complexity of solving the following problem: Given a game g played on a finite directed graph G, output all nodes in G from which a specific player wins the game g. We provide algorithms for solving the above problem when the games have Büchi and parity winning conditions and the graph G is a tree with back-edges. The running time of the algorithm for Büchi games is O(min{r·m, l + m}) where m is the number of edges, l is the sum of the distances from the root to all leaves and the parameter r is bounded by the height of the tree. The algorithm for parity has a running time of O(l + m).
In this paper we deal with a directed graph G = (V, E) with non-negative integer edge costs where the edge costs are bounded by c and |V| = n and m = |E|. We show the all pairs shortest path (APSP) problem can be solved in O(mn + n2 log(c/n))) time with the data structure of cascading bucket system. The idea for speed-up is to share a single priority queue among n single source shortest path (SSSP) problems that are solved for APSP. We use the traditional computational model such that comparison-addition operations on distance data and random access with O(log n) bits can be done in O(1) time. Also the graph is not separated, meaning m ≥ n. Our complexity is best for a relatively large bound on edge cost, c, such that c = o(n log n).
This paper shows that the optimization problem arising from the guarding game played between the cop and robber players on an undirected graph can be approximated within a factor of Θ(log n) when the robber region is a tree.
The semantics of logic programs was originally described in terms of two-valued logic. Soon, however, it was realised that three-valued logic had some natural advantages, as it provides distinct values not only for truth and falsehood, but also for "undefined". The three-valued semantics proposed by Fitting and by Kunen are closely related to what is computed by a logic program, the third truth value being associated with non-termination. A different three-valued semantics, proposed by Naish, shared much with those of Fitting and Kunen but incorporated allowances for programmer intent, the third truth value being associated with underspecification. Naish used an (apparently) novel "arrow" operator to relate the intended meaning of left and right sides of predicate definitions. In this paper we suggest that the additional truth values of Fitting/Kunen and Naish are best viewed as duals. We use Fitting's later four-valued approach to unify the two three-valued approaches. The additional truth value has very little affect on the Fitting three-valued semantics, though it can be useful when finding approximations to this semantics for program analysis. For the Naish semantics, the extra truth value allows intended interpretations to be more expressive, allowing us to verify and debug a larger class of programs. We also explain that the "arrow" operator of Naish (and our four-valued extension) is essentially the information ordering. This sheds new light on the relationships between specifications and programs, and successive executions states of a program.
We consider directed graphs with an upward planar drawing on the plane, the sphere, the standing and the rolling cylinders. In general, the drawings allow complex curves for the edges with many zig-zags and windings around the cylinder and the sphere. The drawings are simplified to polyline drawings with geodesics as straight segments and vertices and bends at grid points. On the standing cylinder the drawings have at most two bends per edge and no windings of edges around the cylinder. On the rolling cylinder edges may have one winding and five bends, and there are graphs where edges must wind. The drawings have a discrete description of linear size. The simplifications can be computed efficiently in O(τ n 3 ) time, where τ is the cost of computing the point of intersection of a curve and a horizontal line through a vertex. The time complexity does not depend on the description complexity of the drawing and its curves, but only on O( n 3 ) sample points.
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 their relaxed variants. We prove that for relaxed weak heaps the execution of any such sequence requires at most 2m + 1.5n lg n element comparisons. This improves over the best bound, at most 2m + 2.89n lg n element comparisons, known for the existing variants of Fibonacci heaps. We programmed six members of the weak-heap family of priority queues. For random data sets, experimental results show that non-relaxed versions are performing best and that rank-relaxed versions are slightly faster than run-relaxed versions. Compared to weak-heap variants, the corresponding weak-queue variants are slightly better in time but not in the number of element comparisons.
A disentanglement puzzle consists of mechanically interlinked pieces, and the puzzle is solved by disentangling one piece from another set of pieces. A string puzzle is a type of disentanglement puzzle, which consists of strings entangled with one or more wooden pieces. In this paper, we consider the generalized string puzzle problem whose input is the layout of strings and a wooden board with holes embedded in the 3-dimensional Euclidean space. We present a polynomial-time transformation from an arbitrary instance f of the 3SAT problem to a string puzzle s such that f is satisfiable if and only if s is solvable. Therefore, the generalized string puzzle problem is NP-hard.