time-complexity
Union-Find algorithm
I was reading about the famous union-find problem, and the book was saying: \"either the find or the union will take O(n) time, and the other one will take O(1)....\"[详细]
2023-04-12 16:18 分类:问答Object.keys() complexity?
Anyone know the time-co开发者_如何学Cmplexity of ECMAScript5\'s Object.keys() in common implementations?Is it O(n) for n keys?Is time proportional to the size of the hash table, assuming a hash implem[详细]
2023-04-12 05:19 分类:问答does setting a column to index in a mysql table ensure O(1) look ups?
so when there\'s an index on a column, and you do a simple SELECT * FROM table WHERE indexed_column = value, is that a O(1) search? does it matter whether the cont开发者_运维知识库ents indexed are int[详细]
2023-04-11 13:30 分类:问答Find the largest subset of it which form a sequence
I came across this problem during an interview forum., Given an int array which might contain duplicates, find the largest subset of it which form a sequence.[详细]
2023-04-11 03:13 分类:问答O(klogk) time algorithm to find kth smallest element from a binary heap
We have an n-node bi开发者_JAVA百科nary heap which contains n distinct items (smallest item at the root). For a k<=n, find a O(klogk) time algorithm to select kth smallest element from the heap.[详细]
2023-04-10 08:47 分类:问答Why is insertion sort faster than quick-sort and bubble-sort for small cases?
I recently read an article that talked about the computation complexity of algorithms. The author mentioned \"why insertion sort is faster than quick-sort a开发者_高级运维nd bubble-sort for small case[详细]
2023-04-10 04:29 分类:问答Proving Fibonacci recursive algorithm time complexity
I am trying to understand a proof by induction in my algorithms text book. Here\'s the author is proving using induction that the T(n) will always be greater than 2^(n/2) (This is for calculating the[详细]
2023-04-09 06:28 分类:问答polynomial time complexity
There\'s this code from here ub4 additive(char *key, ub4 len, ub4 prime) { ub4 hash, i; for (hash=len, i=0; i<len; ++i)[详细]
2023-04-06 13:55 分类:问答Constant Time Membership Indexing for Intervals on the Real Line?
Say I were given a set of weights adding up to 开发者_开发技巧1, and I lined them up one after another to make a series of bins with length proportional to their weight.I assign each bin an integer co[详细]
2023-04-04 04:49 分类:问答Analysis of shell sort
I am reading a book on algorithms it is mentioned on analysis of shell sort algorithm as below: The worst-case running t开发者_开发技巧ime of Shellsort, using Shell\'s increments, is Theta(n square).[详细]
2023-04-03 23:10 分类:问答