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.
 
Thread 'Video on imaginary numbers and some queries'
Hi, I was watching the following video. I found some points confusing. Could you please help me to understand the gaps? Thanks, in advance! Question 1: Around 4:22, the video says the following. So for those mathematicians, negative numbers didn't exist. You could subtract, that is find the difference between two positive quantities, but you couldn't have a negative answer or negative coefficients. Mathematicians were so averse to negative numbers that there was no single quadratic...
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...
Thread 'Unit Circle Double Angle Derivations'
Here I made a terrible mistake of assuming this to be an equilateral triangle and set 2sinx=1 => x=pi/6. Although this did derive the double angle formulas it also led into a terrible mess trying to find all the combinations of sides. I must have been tired and just assumed 6x=180 and 2sinx=1. By that time, I was so mindset that I nearly scolded a person for even saying 90-x. I wonder if this is a case of biased observation that seeks to dis credit me like Jesus of Nazareth since in reality...
Back
Top