首页 | 本学科首页   官方微博 | 高级检索  
相似文献
 共查询到20条相似文献,搜索用时 15 毫秒
1.
In the stable0–1 sorting problem the task is to sort an array ofn elements with two distinct values such that equal elements retain their relative input order. Recently, Munro, Raman and Salowe gave an algorithm which solves this problem inO(n log*n) time and constant extra space. We show that by a modification of their method the stable0–1 sorting is possible inO(n) time andO(1) extra space. Stable three-way partitioning can be reduced to stable0–1 sorting. This immediately yields a stable minimum space quicksort, which sorts multisets in asymptotically optimal time with high probability.  相似文献   

2.
A sequence of real numbers is called twisted if it can be produced from the sorted sequence by repeatedly reversing the order of consecutive subsequences. It is shown that twisted sequences constitute a class of exponentially many members each of which can be recognized and sorted, by a simple on-line algorithm, in linear time.Research was supported by the Austrian Fonds zur Förderung der Wissenschaftlichen Forschung.  相似文献   

3.
We introduce the notion ofsearchability as a property of an in place merging algorithm. We show that a pair of sorted arrays can be merged in place in linear time, so that a search can be performed in logarithmic time at any point during the merging process. We apply this method to devise an implicit data structure which can support searches inO(log2 n) time in the worst case, andO(logn) on the average, and insertions inO(logn) time, in the worst case.This research was partly supported by NSERC under grant A8237 and presented in preliminary form at the 10th International Colloquium on Automata, Languages and Programming.On leave from the University of Chile.  相似文献   

4.
We considered the following natural conjecture: For every sorting algorithm every key will be involved in(logn) comparisons for some input. We show that this is true for most of the keys and prove matching upper and lower bounds. Every sorting algorithm for some input will involvenn /2+1 keys in at leastlog2 n comparisons,>0. Further, there exists a sorting algorithm that will for every input involve at mostnn /c keys in greater thanlog2 n comparisons, wherec is a constant and>0. The conjecture is shown to hold for natural algorithms from the literature.  相似文献   

5.
We give a generalization of the hypergreedy algorithm for minimum weight perfect matching on a complete edge weighted graph whose weights satisfy the triangle inequality. With a modified version of this algorithm we obtain a logn-approximate perfect matching heuristic for points in the Euclidean plane, inO(n log2 n) time.This research was supported in part by the DIMACS Grant No. NSF-STC88-09648.This research was supported in part by the NSF under Grant No. CCR 88-07518.  相似文献   

6.
A general sorting algorithm, having the well knownO(n 2) algorithmsStraight Insertion Sort andSelection Sort as special cases, is described. This algorithm is analyzed in the case that certain choices in the algorithm are done randomly, and this yields an algorithm that has an average complexity ofO(n 1.5) and a worst case complexity ofO(n 2). However, making random choices (by some random number generator) is time consuming, and a simple quasi-random scheme is therefore implemented. Test runs indicate that also this version has average complexity ofO(n 1.5), and it even seems to perform better than the version using real random choices (even if we disregard the time used for the random choices). This version also needs very little administrative overhead, and it therefore compares favourably to many other sorting algorithms for small and medium sized arrays.  相似文献   

7.
We analyze the computational and communication complexity of four sorting algorithms as implemented on a hypercube multicomputer: two variants of hyperquicksort and two variants of quickmerge. Based upon this analysis, machine-specific parameters can be used to determine when each algorithm requires less communication time than the others. We present benchmark results of the four algorithms on a 64-processor NCube/7. The benchmarking provides experimental evidence that hyperquicksort divides the values to be sorted more evenly among the processors than quickmerge. Because it does a better job balancing work between processors, hyperquicksort proves to be uniformly superior to quickmerge.  相似文献   

8.
A boundO(N 1+1/k ) for the running time of Shellsort, withO(logN) passes, is proved very simply by application of a Frobenius basis withk elements.  相似文献   

9.
Skip lists, introduced by Pugh, provide an alternative to search trees, although a precise analysis of their behaviour had been elusive. The exact value of the expected cost for the search of themth element in a skip list ofn elements is derived first in terms of previously studied functions, and secondly as an asymptotic expression. The latter suggests that Pugh's upper bound of the expected search cost is fairly tight for the interesting cases. Assuming a uniform query distribution, the exact and an asymptotic value of the average (over allm) expected search cost in a skip list ofn elements is also derived. Finally, all insert and delete costs are obtained.This research was supported in part by the Natural Science and Engineering Research Council of Canada under grant No. A-8237, the Information Technology Research Centre of Ontario, and FON-DECYT (Chile) under grant 91-1252.  相似文献   

10.
11.
This paper presents a dual approach to detect intersections of hyperplanes and convex polyhedra in arbitrary dimensions. Ind dimensions, the time complexities of the dual algorithms areO(2 d logn) for the hyperplane-polyhedron intersection problem, andO((2d) d–1 log d–1 n) for the polyhedron- polyhedron intersection problem. These results are the first of their kind ford > 3. In two dimensions, these time bounds are achieved with linear space and preprocessing. In three dimensions, the hyperplane-polyhedron intersection problem is also solved with linear space and preprocessing; quadratic space and preprocessing, however, is required for the polyhedron-polyhedron intersection problem. For generald, the dual algorithms require space and preprocessing. All of these results readily extend to unbounded polyhedra.This is an extended and revised version of a paper presented at the 25th Annual Allerton Conference on Communication, Control, and Computing (October 1987). Our work was sponsored by the U.S. Army Research Office (research contract DAAG29-85-0223) and, in the case of the first author, by graduate fellowships from the IBM corporation and the German National Scholarship Foundation.  相似文献   

12.
We give three algorithms for computing the parent of a node in a threaded binary tree, and calculate the average case complexity of each. By comparing these to the unit cost of obtaining the parent of a node with an explicit parent-pointer field, it is possible to balance runtime and storage cost with respect to the task of finding parent nodes in binary trees. The results obtained show that, although the worst case complexity for ann-node tree is obviouslyO(n) for all three algorithms, the average case complexity for two input distributions is asymptotic (from below) to either 3 or 2.  相似文献   

13.
In this paper, we introduce an implicit data structure which represents a forest-structured partial order to efficiently perform, with respect to time and space, the following operations: 1) testing the relation among two elements (checking whether the two elements are related) and 2) given an elementu, searching for its father. The first operation can be performed in constant time, while the second one requires polylog time (logarithmic in the case of bounded degree). The data structure represents the order relation by referring only to internal nodes of the forest, thus achieving in many cases a significant saving in space occupation. Finally, the algorithm is shown to be optimal in a restricted computation model by deriving a lower bound on the space complexity within such a model.Work partially performed in the framework of Esprit BRA project 3075 Algorithms and Complexity and of Italian MURST 40% project Algoritmi e Strutture di Calcolo and partially supported by the National Research Council (CNR) Project Sistemi Informatici e Calcolo Parallelo.  相似文献   

14.
It has been shown by various researchers that designing a perfect hashing function for a fixed set ofn elements requires (n) bits in the worst case. A possible relaxation of this scheme is to partition the set into pages, and design a hash function which maps keys to page addresses, requiring subsequent binary search of the page. We have shown elsewhere that (nk/2 k+1)(1 +o(1)) bits are necessary and sufficient to describe such a hash function where the pages are of size 2 k . In this paper we examine the additional scheme of expanding the address space of the table, which does substantially improve the hash function complexity of perfect hashing, and show that in contrast, it does not reduce the hash function complexity of the paging scheme.Research supported by NSF Grant CCR-9017125 and by a grant from Texas Instruments.  相似文献   

15.
A number of important problems in computational geometry are solved efficiently on 2- or 3-dimensional grids by means of scanline techniques. In the time complexity of solutions to the maximal elements and closure problems, a factor logn is substituted by loglogn, wheren is the number of elements. Next, by using a data structure introduced in the paper, the interval trie, previous solutions to the rectangle intersection and connected component problems are improved upon. Finally, a fast intersection finding algorithm for arbitrarily oriented line segments is presented.  相似文献   

16.
A new algorithm for rearranging a heap is presented and analysed in the average case. The average case upper bound for deleting the maximum element of a random heap is improved, and is shown to be less than [logn]+0.299+M(n) comparisons, *) whereM(n) is between 0 and 1. It is also shown that a heap can be constructed using 1.650n+O(logn) comparisons with this algorithm, the best result for any algorithm which does not use any extra space. The expected time to sortn elements is argued to be less thann logn+0.670n+O(logn), while simulation result points at an average case ofn log n+0.4n which will make it the fastest in-place sorting algorithm. The same technique is used to show that the average number of comparisons when deleting the maximum element of a heap using Williams' algorithm for rearrangement is 2([logn]–1.299+L(n)) whereL(n) also is between 0 and 1, and the average cost for Floyd-Williams Heapsort is at least 2nlogn–3.27n, counting only comparisons. An analysis of the number of interchanges when deleting the maximum element of a random heap, which is the same for both algorithms, is also presented.  相似文献   

17.
In this paper, we present parallel quicksort algorithms running inO((n/p+logp) logn) expected time andO((n/p+logp+log logn) logn) deterministic time respectively, and both withO(n) space by usingp processors on EREW PRAM. Whenp=O(n/logn), the cost is optimal, in terms of the product of time and number of processors. These algorithms can be used to obtain parallel algorithms for constructing balanced binary search trees without using sorting algorithms. One of our quicksort algorithms leads to a parallel quickhull algorithm on EREW PRAM.The work of this author was partially supported by a fellowship from the College of Science, Old Dominion University, Norfolk, VA 23529, USA.  相似文献   

18.
In this paper we show that to construct an implicit, double-ended priority queue organized as a min-max heap, 17/9n = 1.88 ...n comparisons suffice in the worst case (neglectng lower order terms). The algorithm improves the previously best known upper bound of 2.15 ...n comparisons.Some of the ideas given in this paper were presented in a preliminary form at the 1st Scandinavian Workshop on Algorithm Theory, Halmstad (July, 1988) [7].  相似文献   

19.
The splay tree is a self-adjusting binary search tree which has a good amortized performance. This paper studies some properties of top-down splay trees. Different ways to charge for the primitive operations of top-down splaying are discussed. We also give some empirical results concerning the behaviour of different top-down restructuring algorithms.This work was supported by the Academy of Finland.  相似文献   

20.
A fast solution to the complete minimum matching problem using a greedy heuristic is presented, when the points are distributed on a grid domain. For this a data structure which efficiently supports nearest neighbor searches and deletions from a planar point set is developed.  相似文献   

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

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