How is computational complexity determined?

AI Thread Summary
Computational complexity is determined by analyzing the number of operations an algorithm performs relative to the size of its input. For multiplication, the complexity is O(n^2), while more complex expressions like O(5/2n^2.2342) can arise from specific algorithmic behaviors. To determine complexity, one can graph input size against execution time and fit a curve, but theoretical analysis is often preferred. For example, checking all subsets of integers to find a sum of zero results in a complexity of O(2^n) due to the exponential growth of subsets. Ultimately, complexity analysis focuses on worst-case or average-case scenarios based on bit operations rather than empirical execution.
~Death~
Messages
45
Reaction score
0
like for any algorithm?

On wikipedia it lists for multiplication it's O(n^2)

but some of them have decimals like O(5/2n^2.2342) or something so how would you determine that?

Just use a computer and make a graph of input in bytes vs time in seconds and fit a curve to it?

Like I understand for eg the problem of determining if there's exists a subset of integers in another subset of integers such that they add to 0:

If the algorithm was to check each subset, if there's n integers then there's 2^n-1 subsets to check, but then youd have to add each one -so that would count as a step?

so there's 2^n+n-1 steps for an input of n ..does that mean its on the order of O(2^n) ?
 
Last edited:
Mathematics news on Phys.org
You might want to check out http://en.wikipedia.org/wiki/Big-o_notation first.

So yes, 2^n+n-1\in\mathcal{O}(2^n). To determine this, you don't run the algorithm; you have to analyze (usually) the number of bit-operations it takes for your algorithm to terminate, given an input of n bits. Usually this number jumps around depending on the input, so we usually just look at the WORST case or the AVERAGE case.
 
Insights auto threads is broken atm, so I'm manually creating these for new Insight articles. In Dirac’s Principles of Quantum Mechanics published in 1930 he introduced a “convenient notation” he referred to as a “delta function” which he treated as a continuum analog to the discrete Kronecker delta. The Kronecker delta is simply the indexed components of the identity operator in matrix algebra Source: https://www.physicsforums.com/insights/what-exactly-is-diracs-delta-function/ by...
Fermat's Last Theorem has long been one of the most famous mathematical problems, and is now one of the most famous theorems. It simply states that the equation $$ a^n+b^n=c^n $$ has no solutions with positive integers if ##n>2.## It was named after Pierre de Fermat (1607-1665). The problem itself stems from the book Arithmetica by Diophantus of Alexandria. It gained popularity because Fermat noted in his copy "Cubum autem in duos cubos, aut quadratoquadratum in duos quadratoquadratos, et...
Thread 'Imaginary Pythagorus'
I posted this in the Lame Math thread, but it's got me thinking. Is there any validity to this? Or is it really just a mathematical trick? Naively, I see that i2 + plus 12 does equal zero2. But does this have a meaning? I know one can treat the imaginary number line as just another axis like the reals, but does that mean this does represent a triangle in the complex plane with a hypotenuse of length zero? Ibix offered a rendering of the diagram using what I assume is matrix* notation...
Back
Top