Algorithm Analysis (Big Theta)

Click For Summary

Homework Help Overview

The discussion revolves around analyzing the runtime of an algorithm using Big Theta notation. Participants are examining the potential growth rates of the algorithm, specifically considering whether it operates in Θ(n²) or Θ(n log n) as n approaches large values.

Discussion Character

  • Exploratory, Assumption checking, Conceptual clarification

Approaches and Questions Raised

  • Participants are discussing the implications of the floor function in the algorithm's runtime and how it affects the overall order of growth. There are questions about whether certain transformations, like multiplying through by constants, are valid in determining the Big Theta notation.

Discussion Status

Several participants express a strong inclination towards Θ(n²) as the appropriate classification for the algorithm's runtime. There is ongoing exploration of how the floor function influences this classification, with some suggesting that it could lead to a more precise estimate of (1/4)n². However, there is no explicit consensus on the final classification.

Contextual Notes

Participants are working from a shared link containing the algorithm and its trace, which may be influencing their interpretations. The discussion is framed around large values of n, which is a critical aspect of their analysis.

jhudson1
Messages
16
Reaction score
0

Homework Statement


Here is a pastebin link to my question, it contains an algorithm, my trace of the algorithm, and my question.

Homework Equations


I am interested in the theta notation for the runtime of an algorithm

The Attempt at a Solution


Here is the link
http://mathb.in/1202

My thoughts are that the algorithm must run in either n^2 or n lg (n) where lg = log base 2
 
Physics news on Phys.org
jhudson1 said:

Homework Statement


Here is a pastebin link to my question, it contains an algorithm, my trace of the algorithm, and my question.


Homework Equations


I am interested in the theta notation for the runtime of an algorithm

The Attempt at a Solution


Here is the link
http://mathb.in/1202

My thoughts are that the algorithm must run in either n^2 or n lg (n) where lg = log base 2

Which of those choices do you think fits better? And why? Think about LARGE n.
 
n^2 definitely.

I guess what threw me was the floor function. I wasn't sure if I could multiply through that or not and say n^2/2. Since it seems that you can, 1/2 is clearly scaling the order of the algorithm, which is n^2
 
jhudson1 said:
n^2 definitely.

I guess what threw me was the floor function. I wasn't sure if I could multiply through that or not and say n^2/2. Since it seems that you can, 1/2 is clearly scaling the order of the algorithm, which is n^2

Sure. floor(i/2) isn't exactly i/2 but it's pretty close. On the other hand n*log(n) is clearly way off.
 
jhudson1 said:
n^2 definitely.

I guess what threw me was the floor function. I wasn't sure if I could multiply through that or not and say n^2/2. Since it seems that you can, 1/2 is clearly scaling the order of the algorithm, which is n^2

Thinking about this a little more, isn't the more accurate estimate (1/4)*n^2? You don't just multiply but it's still basically n^2.
 

Similar threads

Replies
9
Views
3K
  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 11 ·
Replies
11
Views
5K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K