Find Complexity of S(n) = S(n-1) + n^2.5

  • Thread starter Grouchy187
  • Start date
  • Tags
    Complexity
In summary, the complexity of the equation S(n) = S(n-1) + n^2.5 for n > 1 and where S(1) = 2 can be found by using the formula for the sum of a geometric series, which is Sn = (a(1-r^n))/(1-r), where a is the first term and r is the common ratio. In this case, a = 2 and r = 1.5, so the equation for the complexity would be S(n) = (2(1-1.5^n))/(1-1.5).
  • #1
Grouchy187
1
0
I need to do this problem but I get stuck halfway through,

Homework Statement



Find complexity of S(n) = S(n-1) + n^2.5 for n > 1 and where S(1) = 2


Homework Equations





The Attempt at a Solution



What I did so far..

S(n) = S(n-1) + n^2.5
S(n-1) = S(n-2) + (n-1)^2.5
S(n-2) = S(n-3) + (n-2)^2.5

so following this pattern...

S(3) = S(2) + 3^2.5
S(2) = S(1) + 2^2.5

then canceling,

S(n) = S(1) + 2^2.5 + 3^2.5 + ... + (n-2)^2.5 + (n-1)^2.5 + n^2.5

So basically, it is the Summation of n^2.5

But I do not know how to get a equation from that in terms of n. Any help would be appreciated.
 
Physics news on Phys.org
  • #2




Thank you for sharing your progress on this problem. It seems like you have a good understanding of the pattern in the equation and how to approach finding the complexity. To get an equation in terms of n, you can use the formula for the sum of a geometric series, which is Sn = (a(1-r^n))/(1-r), where a is the first term and r is the common ratio. In this case, a = 2 and r = 1.5, since each term is being multiplied by 1.5. So the equation for the complexity would be S(n) = (2(1-1.5^n))/(1-1.5). I hope this helps you complete your solution. Keep up the good work!
 

Related to Find Complexity of S(n) = S(n-1) + n^2.5

1. What is the complexity of S(n)?

The complexity of S(n) is O(n^2.5), also known as polynomial complexity. This means that the time and space required to execute the function increases at a polynomial rate as the input size (n) increases.

2. How is the complexity of S(n) calculated?

The complexity of S(n) is calculated by analyzing the number of operations required to execute the function as the input size (n) increases. In this case, the function has a loop that runs n times, and within each iteration, there is a constant number of operations (n^2.5). Therefore, the complexity is O(n^2.5).

3. Can the complexity of S(n) be improved?

Yes, the complexity of S(n) can be improved. This can be done by optimizing the algorithm used to calculate S(n). For example, if a more efficient algorithm is used, the complexity could be reduced to O(n^2) or even O(n). However, the complexity cannot be improved beyond O(n) for this particular function.

4. Is S(n) a time or space complexity?

S(n) is a time complexity. It measures the time required to execute the function as the input size (n) increases. This is different from space complexity, which measures the amount of memory required to execute the function.

5. How does the complexity of S(n) affect the efficiency of the algorithm?

The complexity of S(n) directly affects the efficiency of the algorithm. A higher complexity means that the algorithm will take longer to execute and will require more resources. This is why it is important to analyze and optimize the complexity of algorithms to improve efficiency.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
3
Views
872
  • Engineering and Comp Sci Homework Help
Replies
1
Views
245
  • Engineering and Comp Sci Homework Help
Replies
1
Views
771
  • Engineering and Comp Sci Homework Help
Replies
10
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Calculus and Beyond Homework Help
Replies
1
Views
619
  • Engineering and Comp Sci Homework Help
Replies
2
Views
961
  • Introductory Physics Homework Help
Replies
7
Views
749
  • Engineering and Comp Sci Homework Help
Replies
8
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
Back
Top