big-o
Given an array, can I find in O(n) the longest range, whose endpoints are the greatest values in the range?
For a given array of integers, find the maximum distance between 2 points (i and j) t开发者_高级运维hat have higher values than any element between them.[详细]
2023-02-19 07:22 分类:问答Why does counter = counter /2; have O(log(n))?
I know the following code has a complexity of O(log(n)): while (n>1) { counter++; n/=2; } I understand that here, n is being divided in half on each iteration, meaning that if n was 1000 then it[详细]
2023-02-18 15:08 分类:问答T(n) = T(n - sqrt(n))
Does anyone know how to solve this recurrence? Master Theorem doesn\'t work h开发者_运维知识库ere.It seems obvious in O(1) since[详细]
2023-02-18 05:33 分类:问答Where does log(n) come from in the O(N) notation
I know what is O(n) notation and I also understand how I can get notations like O(n), O(n2),开发者_如何学C ....[详细]
2023-02-18 03:33 分类:问答What is the running time of the translation of infix to postfix using queue and stack?
In c++... I know the time complexities for the individual functions of queue and stack, but I don\'t know what the time complexity for an infixToPostfix function would be, using both queue and stack..[详细]
2023-02-17 00:01 分类:问答Split a string to a string of valid words using Dynamic Programming
I need to find a dynamic programming algorithm to solve this problem. I tried but couldn\'t figure it out. Here is the problem:[详细]
2023-02-16 18:24 分类:问答If f = O(g), is e^f = O(e^g)?
If f = O(g), is e^f 开发者_运维问答= O(e^g)? I\'m having difficultly figuring out the above question. An example would be welcome. Also, if you use l\'Hôpital\'s rule, please show how you do differe[详细]
2023-02-16 01:25 分类:问答Data structure for fast insertion/deletion with sorting
I\'m desperately looking for a data structure allowing me to perform a good amount of insertions, almost as many deletions (probably same order of magnitude) and a very quick lookup of the highest (or[详细]
2023-02-15 05:35 分类:问答Algorithms with superexponential runtime?
I was talking with a student the other day about the common complexity classes of algorithms, like O(n), O(nk), O(n lg n), O(2n), O(n!), etc.I was trying to come up with an example of a problem for wh[详细]
2023-02-14 22:06 分类:问答Why isn't LinkedList.Clear() O(1)
I was assuming LinkedList.Clear() was O(1) on a project I\'m working on, as I used a LinkedList to drain a BlockingQueue in my consumer that needs high throughput, clearing and reusing the LinkedList[详细]
2023-02-14 18:00 分类:问答