首页 | 本学科首页   官方微博 | 高级检索  
相似文献
 共查询到20条相似文献,搜索用时 656 毫秒
1.
Given a real number sequence A=(a1,a2,…,an), an average lower bound L, and an average upper bound U, the Average-Constrained Maximum-Sum Segment problem is to locate a segment A(i,j)=(ai,ai+1,…,aj) that maximizes i?k?jak subject to . In this paper, we give an O(n)-time algorithm for the case where the average upper bound is ineffective, i.e., U=∞. On the other hand, we prove that the time complexity of the problem with an effective average upper bound is Ω(nlogn) even if the average lower bound is ineffective, i.e., L=−∞.  相似文献   

2.
Let A=〈a1,a2,…,am〉 and B=〈b1,b2,…,bn〉 be two sequences, where each pair of elements in the sequences is comparable. A common increasing subsequence of A and B is a subsequence 〈ai1=bj1,ai2=bj2,…,ail=bjl〉, where i1<i2<?<il and j1<j2<?<jl, such that for all 1?k<l, we have aik<aik+1. A longest common increasing subsequence of A and B is a common increasing subsequence of the maximum length. This paper presents an algorithm for delivering a longest common increasing subsequence in O(mn) time and O(mn) space.  相似文献   

3.
A king in a tournament is a player who beats any other player directly or indirectly. According to the existence of a king in every tournament, Wu and Sheng [Inform. Process. Lett. 79 (2001) 297-299] recently presented an algorithm for finding a sorted sequence of kings in a tournament of size n, i.e., a sequence of players u1,u2,…,un such that uiui+1 (ui beats ui+1) and ui is a king in the sub-tournament induced by {ui,ui+1,…,un} for each i=1,2,…,n−1. With each pair u,v of players in a tournament, let b(u,v) denote the number of third players used for u to beat v indirectly. Then, a king u is called a strong king if the following condition is fulfilled: if vu then b(u,v)>b(v,u). In the sequel, we will show that the algorithm proposed by Wu and Sheng indeed generates a sorted sequence of strong kings, which is more restricted than the previous one.  相似文献   

4.
Finding the longest common subsequence (LCS) of two given sequences A=a0a1am−1 and B=b0b1bn−1 is an important and well studied problem. We consider its generalization, transposition-invariant LCS (LCTS), which has recently arisen in the field of music information retrieval. In LCTS, we look for the LCS between the sequences A+t=(a0+t)(a1+t)…(am−1+t) and B where t is any integer. We introduce a family of algorithms (motivated by the Hunt-Szymanski scheme for LCS), improving the currently best known complexity from O(mnloglogσ) to O(Dloglogσ+mn), where σ is the alphabet size and D?mn is the total number of dominant matches for all transpositions. Then, we demonstrate experimentally that some of our algorithms outperform the best ones from literature.  相似文献   

5.
Sorting is a classic problem and one to which many others reduce easily. In the streaming model, however, we are allowed only one pass over the input and sublinear memory, so in general we cannot sort. In this paper we show that, to determine the sorted order of a multiset s of size n containing σ?2 distinct elements using one pass and o(nlogσ) bits of memory, it is generally necessary and sufficient that its entropy H=o(logσ). Specifically, if s={s1,…,sn} and si1,…,sin is the stable sort of s, then we can compute i1,…,in in one pass using O((H+1)n) time and O(Hn) bits of memory, with a simple combination of classic techniques. On the other hand, in the worst case it takes that much memory to compute any sorted ordering of s in one pass.  相似文献   

6.
A closed interval is an ordered pair of real numbers [xy], with x ? y. The interval [xy] represents the set {i ∈ Rx ? i ? y}. Given a set of closed intervals I={[a1,b1],[a2,b2],…,[ak,bk]}, the Interval-Merging Problem is to find a minimum-cardinality set of intervals M(I)={[x1,y1],[x2,y2],…,[xj,yj]}, j ? k, such that the real numbers represented by equal those represented by . In this paper, we show the problem can be solved in O(d log d) sequential time, and in O(log d) parallel time using O(d) processors on an EREW PRAM, where d is the number of the endpoints of I. Moreover, if the input is given as a set of sorted endpoints, then the problem can be solved in O(d) sequential time, and in O(log d) parallel time using O(d/log d) processors on an EREW PRAM.  相似文献   

7.
In this note, we outline a very simple algorithm for the following problem: Given a set S of n points p1,p2,p3,…,pn in the plane, we have O(n2) segments implicitly defined on pairs of these n points. For each point pi, find a segment from this set of implicitly defined segments that is farthest from pi. The time complexity of our algorithm is in O(nh+nlogn), where n is the number of input points, and h is the number of vertices on the convex hull of S.  相似文献   

8.
A binary image I is Ba, Wb-connected, where ab ∈ {4, 8}, if its foreground is a-connected and its background is b-connected. We consider a local modification of a Ba, wb-connected image I in which a black pixel can be interchanged with an adjacent white pixel provided that this preserves the connectivity of both the foreground and the background of I. We have shown that for any (ab) ∈ {(4, 8), (8, 4), (8, 8)}, any two Ba, wb-connected images I and J each with n black pixels differ by a sequence of Θ(n2) interchanges. We have also shown that any two B4, W4-connected images I and J each with n black pixels differ by a sequence of O(n4) interchanges.  相似文献   

9.
Givenn numbersa 0,a 1,...,a n –1, it is required to compute all sums of the forma 0+a 1+...+a i , fori=0, 1,...,n–1. This problem arises in many applications and is trivial to solve sequentially in O(n) time. Besides its practical importance, the problem gains an additional theoretical interest in parallel computation. A technique known asrecursive doubling allows all sums to be computed in O(logn) time on a model of computation wheren processors communicate through aninverse perfect suffle interconnection network. In this paper we show how the problem can be solved on a simple network, namely abinary tree of processors. In addition, we show how to extend our solution to obtain an optimal-cost algorithm. The algorithm usesp processors and runs in O((n/p)+logp) time, for a cost of O(n+p logp). This cost is optimal whenp logp=O(n). Finally, two applications of our results are illustrated, namely job scheduling with deadlines and the knapsack problem.This work was supported by the Natural Sciences and Engineering Research Council of Canada under Grants A0282 and A3336.  相似文献   

10.
In this paper we investigate the online hypergraph coloring problem. In this online problem the algorithm receives the vertices of the hypergraph in some order v1,…,vn and it must color vi by only looking at the subhypergraph Hi=(Vi,Ei) where Vi={v1,…,vi} and Ei contains the edges of the hypergraph which are subsets of Vi. We show that there exists no online hypergraph coloring algorithm with sublinear competitive ratio. Furthermore we investigate some particular classes of hypergraphs (k-uniform hypergraphs, hypergraphs with bounded matching number, projective planes), we analyse the online algorithm FF and give matching lower bounds for these classes.  相似文献   

11.
Given q+1 strings (a text t of length n and q patterns m1,…,mq) and a natural number w, the multiple serial episode matching problem consists in finding the number of size w windows of text t which contain patterns m1,…,mq as subsequences, i.e., for each mi, if mi=p1,…,pk, the letters p1,…,pk occur in the window, in the same order as in mi, but not necessarily consecutively (they may be interleaved with other letters). Our main contribution here is an algorithm solving this problem on-line in time O(nq) with an MP-RAM model (which is a RAM model equipped with extra operations).  相似文献   

12.
Let S={s1,…,sn} be a set of points in the plane. The Oja depth of a query point θ with respect to S is the sum of the areas of all triangles (θ,si,sj). This depth may be computed in O(nlogn) time in the RAM model of computation. We show that a matching lower bound holds in the algebraic decision tree model. This bound also applies to the computation of the Oja gradient, the Oja sign test, and to the problem of computing the sum of pairwise distances among points on a line.  相似文献   

13.
For a positive integer c, a c-vertex-ranking of a graph G=(V,E) is a labeling of the vertices of G with integers such that, for any label i, deletion of all vertices with labels >i leaves connected components, each having at most c vertices with label i. The c-vertex-ranking problem is to find a c-vertex-ranking of a given graph using the minimum number of ranks. In this paper we give an optimal parallel algorithm for solving the c-vertex-ranking problem on trees in O(log2n) time using linear number of operations on the EREW PRAM model.  相似文献   

14.
We prove that there is a polynomial time substitution (y1,…,yn):=g(x1,…,xk) with k?n such that whenever the substitution instance A(g(x1,…,xk)) of a 3DNF formula A(y1,…,yn) has a short resolution proof it follows that A(y1,…,yn) is a tautology. The qualification “short” depends on the parameters k and n.  相似文献   

15.
In this paper we consider the following problem. Given (r 1,r 2, ...,r n) R n, for anyI= (I 1,I 2,...,I n) Z n, letE 1=(e ij), wheree ij=(r i–rj)–(I i–Ij), findI Z n such that |E I| is minimized, where |·| is a matrix norm. This problem arises from optimal curve rasterization in computer graphics, where minimum distortion of curve dynamic context is sought. Until now, there has been no polynomial-time solution to this computer graphics problem. We present a very simpleO(n lgn)-time algorithm to solve this problem under various matrix norms.This research was supported by the Natural Sciences and Engineering Research Council of Canada under Grant OGP0046373.  相似文献   

16.
In this paper, we give a relatively simple though very efficient way to color the d-dimensional grid G(n1,n2,…,nd) (with ni vertices in each dimension 1?i?d), for two different types of vertex colorings: (1) acyclic coloring of graphs, in which we color the vertices such that (i) no two neighbors are assigned the same color and (ii) for any two colors i and j, the subgraph induced by the vertices colored i or j is acyclic; and (2) k-distance coloring of graphs, in which every vertex must be colored in such a way that two vertices lying at distance less than or equal to k must be assigned different colors. The minimum number of colors needed to acyclically color (respectively k-distance color) a graph G is called acyclic chromatic number of G (respectively k-distance chromatic number), and denoted a(G) (respectively χk(G)).The method we propose for coloring the d-dimensional grid in those two variants relies on the representation of the vertices of Gd(n1,…,nd) thanks to its coordinates in each dimension; this gives us upper bounds on a(Gd(n1,…,nd)) and χk(Gd(n1,…,nd)).We also give lower bounds on a(Gd(n1,…,nd)) and χk(Gd(n1,…,nd)). In particular, we give a lower bound on a(G) for any graph G; surprisingly, as far as we know this result was never mentioned before. Applied to the d-dimensional grid Gd(n1,…,nd), the lower and upper bounds for a(Gd(n1,…,nd)) match (and thus give an optimal result) when the lengths in each dimension are “sufficiently large” (more precisely, if ). If this is not the case, then these bounds differ by an additive constant at most equal to . Concerning χk(Gd(n1,…,nd)), we give exact results on its value for (1) k=2 and any d?1, and (2) d=2 and any k?1.In the case of acyclic coloring, we also apply our results to hypercubes of dimension d, Hd, which are a particular case of Gd(n1,…,nd) in which there are only 2 vertices in each dimension. In that case, the bounds we obtain differ by a multiplicative constant equal to 2.  相似文献   

17.
The recurrencex o =a o x i =a i+b i x i–1,i = 1, 2,...,n–1 requiresO(n) operations on a sequential computer. Elegant parallel solutions exist, however, that reduce the complexity toO(logN) usingNn processors. This paper discusses one such solution, designed for a tree-structured network of processors.A tree structure is ideal for solving recurrences. It takes exactly one sweep up and down the tree to solve any of several classes of recurrences, thus guaranteeing a solution inO(logN) time for a tree withNn leaf nodes. Ifn exceedsN, the algorithm efficiently pipelines the operation and solves the recurrence inO(n/N + logN) time.  相似文献   

18.
Tudor Jebelean and Ken Weber introduced an algorithm for finding (a,b)-pairs satisfying au+bv≡0 (mod k), with . It is based on Sorenson's “k-ary reduction”. This algorithm does not preserve the GCD and its related GCD algorithm has an O(n2) time bit complexity in the worst case. We present a modified version which avoids this problem. We show that a slightly modified GCD algorithm has an O(n2/logn) running time in the worst case, where n is the number of bits of the larger input.  相似文献   

19.
A unit cube in k-dimension (or a k-cube) is defined as the Cartesian product R1×R2×?×Rk, where each Ri is a closed interval on the real line of the form [ai,ai+1]. The cubicity of G, denoted as cub(G), is the minimum k such that G is the intersection graph of a collection of k-cubes. Many NP-complete graph problems can be solved efficiently or have good approximation ratios in graphs of low cubicity. In most of these cases the first step is to get a low dimensional cube representation of the given graph.It is known that for a graph G, . Recently it has been shown that for a graph G, cub(G)?4(Δ+1)lnn, where n and Δ are the number of vertices and maximum degree of G, respectively. In this paper, we show that for a bipartite graph G=(AB,E) with |A|=n1, |B|=n2, n1?n2, and Δ=min{ΔA,ΔB}, where ΔA=maxaAd(a) and ΔB=maxbBd(b), d(a) and d(b) being the degree of a and b in G, respectively, cub(G)?2(Δ+2)⌈lnn2⌉. We also give an efficient randomized algorithm to construct the cube representation of G in 3(Δ+2)⌈lnn2⌉ dimensions. The reader may note that in general Δ can be much smaller than Δ.  相似文献   

20.
Given a sorted sequence A = a1, a2, ..., an of items from a totally ordered universe, along with an arbitrary sequence Q = q1, q2, ..., qm (1 ≤ mn) of queries, the multiple search problem involves computing for every qj (1 ≤ jm) the unique ai for which ai−1qj < ai. In this paper we propose a time-optimal algorithm to solve the multiple search problem on meshes with multiple broadcasting. More specifically, on a [formula] × [formula] mesh with multiple broadcasting, our algorithm runs in [formula] time which is shown to be time-optimal. We also present some surprising applications of the multiple search algorithm to computer graphics, image processing, robotics, and computational geometry.  相似文献   

设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号