complexity

Big O, how do you calculate/approximate it?

Most people with a degree in CS will certainly know what Big O stands for. It helps us to measure how (in)efficient an algorithm really is and if you know in what category the problem you are trying to solve lays in you can figure out if it is still possible to squeeze out that little extra performance.* But I'm curious, how do you calc...

What's your/a good limit for cyclomatic complexity?

Our customers have begun to impose cyclomatic complexity requirements on the software within our products, and our internal process "improvement" group has decided to make cyclomatic complexity part of our coding standards. Both the customer and our internal group have set their (recommendation for an) upper limit at 10. I've argued that...

What tools do you use for static code analysis?

This question on Cyclomatic Complexity made me think more about static code analysis. Analyzing code complexity and consistency is occasionally useful, and I'd like to start doing it more. What tools do you recommend (per language) for such analysis? Wikipedia has a large list of tools, but which ones have people tried before? Edit: ...

Complexity of Regex substitution

I didn't get the answer to this anywhere. What is the runtime complexity of a Regex match and substitution? Edit: I work in python. But would like to know in general about most popular languages/tools (java, perl, sed). ...

Where can I find the time and space complexity of the built-in sequence types in Python

I've been unable to find a source for this information, short of looking through the Python source code myself to determine how the objects work. Does anyone know where I could find this online? ...

What level of complexity requires a framework?

At what level of complexity is it mandatory to switch to an existing framework for web development? What measurement of complexity is practical for web development? Code length? Feature list? Database Size? ...

Prim's Algorithm, Priority First Search and Minimum Spanning Trees (MST)

Prims algorithm is a priority first search algorithm. If this is the case, why does Sedgewick refer to the MST algorithm for a sparse graph as the priority first search algorithm but the MST algorithm for a dense graph is called Prim's algorithm? The complexity differences between the two only arise because (a) the properties of sparse ...

How do you prevent over complicated solutions or designs?

Many times we find ourselves working on a problem, only to figure out the solution being created is far more complex than the problem requires. Are there controls, best practices, techniques, etc that help you control over complication in your workplace? ...

What's "P=NP?", and why is it such a famous question?

The question of whether P=NP is perhaps the most famous in all of Computer Science. What does it mean? And why is it so interesting? Oh, and for extra credit, please post a proof of the statement's truth or falsehood. :) ...

Did you apply computational complexity theory in real life?

I'm taking a course in computational complexity and have so far had an impression that it won't be of much help to a developer. I might be wrong but if you have gone down this path before, could you please provide an example of how the complexity theory helped you in your work? Tons of thanks. ...

What is the time complexity of indexing, inserting and removing from common data structures?

There is no summary available of the big O notation for operations on the most common data structures including arrays, linked lists, hash tables etc. ...

Tool for calculating cyclomatic complexity

Can you recommend free tools for calcualting cyclomatic complexity. Looking for all languages. One tool/language per answer please. ...

What is Big O notation? Do you use it?

What is Big O notation? Do you use it? I missed this university class I guess :D Does anyone use it and give some real life examples of where they used it? See also: Big-O for Eight Year Olds? Big O, how do you calculate/approximate it? Did you apply computational complexity theory in real life? ...

Hashtable in C++?

I usually use C++ STL map whenever I need to store some data associated with a specific type of value (a key value - e.g. a string or other object). The STL map implementation is based on trees which provides better performance (O(log n)) than the standard array or STL vector. My questions is, do you know of any C++ "standard" hashtable...

which tools are helpful in determining the cyclomatic complexity of a given C source code

I want to know which tool can be used to measure the cyclomatic complexity of a C source. I have seen other post which ask the same question but I want to know specific tool for C source only. ...

In-memory LINQ performance

More than about LINQ to [insert your favorite provider here], this question is about searching or filtering in-memory collections. I know LINQ (or searching/filtering extension methods) works in objects implementing IEnumerable or IEnumerable<T>. The question is: because of the nature of enumeration, is every query complexity at least ...

Constant Amortized Time

What is meant by "Constant Amortized Time" when talking about time complexity of an algorithm? ...

Efficient traversal of a changelist

I have a list of changes to a list - Adds and Deletes. The list could be huge - say 10'000 items. I want to know the state of the list after change 9'000. I could walk the list from the start all the way to change 9'000. That seems a bit long-winded to me. I could keep a list of items and record when they're added and when they're de...

Recursion and Big O

I've been working through a recent Computer Science homework involving recursion and big-O notation. I believe I understand this pretty well (certainly not perfectly, though!) But there is one question in particular that is giving me the most problems. The odd thing is that by looking it, it looks to be the most simple one on the homewor...

Dealing with complexity

Forgive me for asking a rather general question, but how do you psychologically deal with high levels of complexity in software projects? I'm working on a personal compiler project and am currently trying to understand the unmanaged .net metadata API (and before anybody mentions it, Reflection.Emit is not sufficient for my needs!) which...