HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Using software to calculate the complexity of an algorithm

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
thealgorithmcalculatesoftwareusingcomplexity

Problem

I am somewhat a beginner, and I have often seen complexity being calculated for various algorithms but they never actually gave me a very clear idea about how it is done. Can someone please point some resources where I can learn to calculate the complexity of an algorithm?

Secondly, is there some software that calculates the space and time complexity for an algorithm? I have seen that cyclomatic complexity can be calculated by software.

Solution

Depending on your background, the CLRS book is a solid introduction. I think in the very first chapter, they walk you through of how to analyze a simple algorithm in terms of both correctness (showing the algorithm really solves the problem) and complexity (how many steps the algorithm performs). There are lots of other books out there some other people might prefer more.

In general, there is no software that does this for you. Coming up with right invariants etc. is somewhat of an art requiring insight and experience. Read more about complexity theory, and you'll discover some inherit impossibilities and problems related to automating such analysis.

Context

StackExchange Computer Science Q#12475, answer score: 7

Revisions (0)

No revisions yet.