How is computational complexity determined?

In summary, the conversation discusses the use of Big-O notation for determining the time complexity of algorithms. It is mentioned that for multiplication, it is O(n^2) and for determining if a subset of integers adds to 0, it is on the order of O(2^n). The speaker suggests using a computer to graph input vs time and fit a curve to determine the time complexity. They also mention the importance of analyzing the worst or average case for accurate results.
  • #1
~Death~
45
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
  • #2
You might want to check out http://en.wikipedia.org/wiki/Big-o_notation first.

So yes, [itex]2^n+n-1\in\mathcal{O}(2^n)[/itex]. 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.
 

1. What is computational complexity?

Computational complexity refers to the amount of time and resources required to solve a problem using an algorithm or computer program.

2. How is computational complexity measured?

Computational complexity is typically measured by the number of steps or operations required to solve a problem, known as the time complexity, as well as the amount of memory or space required, known as the space complexity.

3. What factors determine computational complexity?

The main factors that determine computational complexity are the size of the input data, the efficiency of the algorithm used to solve the problem, and the capabilities of the computer or processor running the algorithm.

4. How is computational complexity different from algorithmic complexity?

Computational complexity focuses on the resources required to solve a problem, while algorithmic complexity measures the inherent complexity of a problem itself. In other words, computational complexity is dependent on the algorithm used, while algorithmic complexity is independent of the algorithm.

5. Can computational complexity be reduced?

In most cases, computational complexity cannot be reduced beyond a certain point. However, by using more efficient algorithms and optimizing code, it is possible to reduce the time and space complexity of a problem.

Similar threads

  • General Math
Replies
1
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Linear and Abstract Algebra
Replies
11
Views
1K
Replies
7
Views
1K
Replies
1
Views
2K
  • General Math
Replies
23
Views
5K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
930
Replies
36
Views
6K
Back
Top