complexity

Number base conversion as a stream operation

Is there a way in constant working space to do arbitrary size and arbitrary base conversions. That is, to convert a sequence of n numbers in the range [1,m] to a sequence of ceiling(n*log(m)/log(p)) numbers in the range [1,p] using a 1-to-1 mapping that (preferably but not necessarily) preservers lexigraphical order? I'm particularly in...

What is the most complex web-site / web-page you have created or seen?

What was the most complex / complicated web-site or web-page that you have created or seen? What made it so complicated or complex? ...

What would a P=NP proof be like, hypothetically?

Would it be an polynomial time algorithm to a specific NP-complete problem, or just abstract reasonings that demonstrate solutions to NP-complete problems exist? It seems that the a specific algoithm is much more helpful. With it, all we'll have to do to polynomially solve an NP problem is to convert it into the specific NP-complete p...

Are there any O(1/n) algorithms?

Are there any O(1/n) algorithms? Or anything else which is less than O(1)? ...

VB .net query to find efficiency of code

I have developed an algorithm using VB .net to cluster the given dataset. I need output including time complexity of this code, space complexity and total execution time of this code. How I will be able to achieve this? Kindly let me know at your earliest, I will appreciate the same. Warm regards. Preeti Mulay ...

A min-heap with better than O(logn) increase key?

I'm using a priority queue that initially bases the priority of its elements on a heuristic. As elements are dequeued the heuristic is updated and elements currently in the queue may have their keys increased. I know there are heaps (Fibonacci heaps specifically) that have amortized O(1) decrease key operations, but are there any heap ...

O(N log N) Complexity - Similar to linear?

Hey All, So I think I'm going to get buried for asking such a trivial question but I'm a little confused about something. I have implemented quicksort in Java and C and I was doing some basic comparissons. The graph came out as two straight lines, with the C being 4ms faster than the Java counterpart over 100,000 random integers. Th...

condense SQL in mySQL

How can I simplify this code in MySQL? SELECT name, MAX(IF(to_days(thedate) - to_days('2009-06-13') = 0, price, '')) AS date1, MAX(IF(to_days(thedate) - to_days('2009-06-13') = 1, price, '')) AS date2, MAX(IF(to_days(thedate) - to_days('2009-06-13') = 2, price, '')) AS date3, MAX(IF(to_days(thedate) - to_days('2009-06-13') = 3, ...

i18n - Internationalization Password Complexity Rules

I'm currently working on the internationalization of a product and an issue has come up. The issue revolves around password complexity requirements for countries with non-Latin languages and complex character sets. The application uses aspnet membership for user and password management, although this might be a whole other issue. Curre...

What is the runtime complexity of python list functions?

I was writing a python function that looked something like this def foo(some_list): for i in range(0, len(some_list)): bar(some_list[i], i) so that it was called with x = [0, 1, 2, 3, ... ] foo(x) I had assumed that index access of lists was O(1), but was surprised to find that for large lists this was significantly slowe...

Where do I find a comparison of different STL containers complexity (performance)?

I googled quite a while in order to find out a comparison that shows the differences in complexity for all STL-Containers on insert/push erase/pop etc. I did not find any. Also not in all of my STL Books. Any hint? I know some rules of thumb of course. But where is a definition? ...

Unable to deduce a table about algorithms' effectiveness

I am not completely sure about the following table The table provides the size of problem that can be solved in the time limit given in the left-hand column when the algorithmic complexity is of the given size. I am interested in the deduction of the table. The table suggests me that O(n) = 10M in a second (This seems to be the p...

General rules for simplifying SQL statements

I'm looking for some "inference rules" (similar to set operation rules or logic rules) which I can use to reduce a SQL query in complexity or size. Does there exist something like that? Any papers, any tools? Any equivalencies that you found on your own? It's somehow similar to query optimization, but not in terms of performance. To sta...

Why so serious, er.. complex?

I was just glancing at a related question list on this very site and it got me thinking. I see a lot of questions like: Should I deploy XYZ with my package or add a reference to some other path? How do I configure nant/cruisecontrol/etc.. to run my unit tests? Where should I keep my config files for unit tests in XYZ setup etc... Now...

Cost of len() function

What is the cost of len() function for Python built-ins? Is it same for all built-ins? (list/tuple/string/dictionary) ...

.NET Console Application Exit Event

Using .NET is there a method, such as an event, of detecting when a Console Application is exiting, I need to clean up some threads and COM objects? I am running a message loop, without a form, from the console application. A DCOM component that I am using seems to require that the application pump messages. I have tried adding a hand...

Code complexity analysis tools beyond cyclomatic complexity

While cyclomatic complexity is a worthwhile metric, I tend to find it to be a poor tool for identifying difficult to maintain code. In particular, I tend to find it just highlights certain types of code (e.g. parsers) and misses difficult recursion, threading and coupling problems as well as many of the anti-patterns that have been defi...

Programming languages complexity

Is there an objective measure of a programming language's complexity in terms of syntax and semantics, not how complex the language is to use ? I've read many subjective comments but little rigorous analysis. ...

how to find the time complexity using step count

sum(array,n) { tsum=0; for(i=0;i<n;i++) tsum=tsum+array[i]; return tsum; } ...

Some Questions on Complexity

1) Reorder the following efficiency from smallest to largest: 2^n, n!, n^5, 10000, nlog2(n) My Ans-> 10000 < nlog2(n) < n^5 < 2^n < n! Correct ? 2) Efficiency of an algo. is n^3, if a step in this algo. takes 1 nanosec. (10^-9 sec.). How long does it take the algo. to process an input of size 1000? I don't know ... Is it (...