asymptotic-complexity

Asymptotic complexity of .NET collection classes

Are there any resources about the asymptotic complexity (big-O and the rest) of methods of .NET collection classes (Dictionary<K,V>, List<T> etc...)? I know that the C5 library's documentation includes some information about it (example), but I'm interested in standard .NET collections too... (and PowerCollections' information would als...

Asymptotic Notation - does n (log n) (log n) simplify?

If I have an algorithm that takes n log n steps (e.g. heapsort), where the steps take log n time (e.g. comparison/exchange of "big" integers in the range 0 to n-1), what is the asymptotic bound for the whole process. Obviously we can say "n (log n) (log n)", but I'm having a hard time trying to convince myself that I cannot simplify thi...

Determining time and space complexity

I am having some trouble determining space and time complexities. For example, if I have a tree that has a branching factor b and will have at most a depth d, how can I calculate the time and space complexities? I know they are O(b^d) and O(bd) , but my problem is how to get to those values. Thanks! ...

Big O Notation question

If I have an algorithm that takes 4n^2 + 7n moves to accomplish, what is it's O? O(4n^2)? O(n^2)? I know that 7n is cut off, but I don't know if I should keep n^2 coefficient or not. Thanks ...

Solving recurrences

Am trying to solve the given recursion, using recursion tree, T(n) = 3T(n/3) + n/lg n. In the first level (n/3)/(log(n/3)) + (n/3)/(log(n/3)) + (n/3)/(log(n/3)) = n/(log(n/3)). In the second level it turns out to be n/(log(n/9)). Can I generalize the above equation in the form of n.loglogn This is a general doubt I've, I need an in...

Mergesort to sort three input arrays

A Merge algorithm merges two sorted input arrays into a sorted output array, by repeatedly comparing the smallest elements of the two input arrays, and moving the smaller one of the two to the output. Now we need to merge three sorted input arrays (A1, A2, and A3) of the same length into a (sorted) output array, and there are two method...

Asymptotic complexity of a compiler

What is the maximal acceptable asymptotic runtime of a general-purpose compiler? For clarification: The complexity of compilation process itself, not of the compiled program. Depending on the program size, for instance, the number of source code characters, statements, variables, procedures, basic blocks, intermediate language instructi...

Proving that a function f(n) belongs to a Big-Theta(g(n))

Its a exercise that ask to indicate the class Big-Theta(g(n)) the functions belongs to and to prove the assertion. In this case f(n) = (n^2+1)^10 By definition f(n) E Big-Theta(g(n)) <=> c1*g(n) < f(n) < c2*g(n), where c1 and c2 are two constants. I know that for this specific f(n) the Big-Theta is g(n^20) but I don't know who to prov...

C++ Asymptotic Profiling

I have a performance issue where I suspect one standard C library function is taking too long and causing my entire system (suite of processes) to basically "hiccup". Sure enough if I comment out the library function call, the hiccup goes away. This prompted me to investigate what standard methods there are to prove this type of thing? W...

np-complete but not "hard"

Is there some language that is NP-complete but for which we know some "quick" algorithm? I don't mean like the ones for knapsack where we can do well on average, I mean that even in the worst case the runtime is something like 2^n^epsilon, where the result holds for any epsilon>0 and so we can allow it to get arbitrarily close to 0. ...

Function which is Big O(1) but not Ω(1)

Can some help me with a function which is Big O(1) but not Ω(1) and the other way around? Some explanation would greatly help. ...

Help with asymptotic analysis

Hi, I'm rather new to programming and have recently been introduced to the topic of asymptotic complexity. What I'm curious about is how to figure out the asymptotic complexity of a sorting method, given the number of elements and the time taken to sort them. Here is an example of what I mean. Time for 'sortArray' to sort sorted arra...

Complexity proof

I would to prove the following example: n^k = O (c^n) for every k and c>1 It is noticeable that the polynomial function grows faster than exponential function. We try to find k0 > 0 satisfying the condition fn > = k0 * g(n) Than n^k <= k0 * c^n log(n^k) <= log (k0 * c^n) log(n^(k/n)) <= log (k0 * c) k0 >= 1/c*n^(k/n) So, k0 > 0,...

Example of O(n!)?

What is an example (in code) of a O(n!) function? It should take appropriate number of operations to run in reference to n; that is, I'm asking about time complexity. ...

Fundamentals and maths required for algorithms

I have been working on RTOS and Linux driver development for quite some time. Now I am interviewing at semiconductor companies and failing to answer questions about algorithms on strings, and time and space complexity. I have not studied discrete maths and algorithms during my as I have an electronics background. How can I overcome thi...

Throwing cats out of windows

Imagine you're in a tall building with a cat. The cat can survive a fall out of a low story window, but will die if thrown from a high floor. How can you figure out the longest drop that the cat can survive, using the least number of attempts? Obviously, if you only have one cat, then you can only search linearly. First throw the cat fr...