Question trying to physically understand Algorithm run time as proportion In CLRS, there's a question in the first chapter that says for certain functions runtime=f(n), to calculate the max number of n given the run time. The math works out simply. For example, for f(n)=sqrt(n) microseconds, given a 1 second run time there is ((1 second)/(10^(-6) seconds))^2 inputs n, which I got from sqrt(n) microseconds=1 second and solving for n. My confusion comes from trying to make a proportion for the system like I would for a dimensional analysis problem. I have (sqrt(n) microseconds)/(n inputs) and the other fraction is (1 second)/(x inputs). Here when I solve for x I get 10^6*sqrt(n). I think my dimensions don't make sense somehow, but in my head, saying 'it takes square root of n microseconds

joyoshibb

joyoshibb

Open question

2022-08-19

Question trying to physically understand Algorithm run time as proportion
In CLRS, there's a question in the first chapter that says for certain functions r u n t i m e = f ( n ), to calculate the max number of n given the run time. The math works out simply. For example, for f ( n ) = n microseconds, given a 1 second run time there is 1   s e c o n d 10 6   s e c o n d s 2 inputs n, which I got from n   m i c r o s e c o n d s = 1   s e c o n d and solving for n.
My confusion comes from trying to make a proportion for the system like I would for a dimensional analysis problem. I have n   m i c r o s e c o n d s n   i n p u t s and the other fraction is 1   s e c o n d x   i n p u t s . Here when I solve for x I get 10 6 n . I think my dimensions don't make sense somehow, but in my head, saying 'it takes square root of n microseconds for n inputs' comes out as n   m i c r o s e c o n d s n   i n p u t s
Thank you!!

Answer & Explanation

kilinumad

kilinumad

Beginner2022-08-20Added 21 answers

Since no one really answered this, this is what I think is some physical intuition behind the situation.
It takes n   m i c r o s e c o n d s to solve a given problem, so no matter what it is true that it took n   m i c r o s e c o n d s p r o b l e m   o f   a n y   s i z e   n . So if the problem took 1 second to solve (for whatever n), the fraction would be 1   s e c o n d s p r o b l e m   o f   s i z e   n . And since we know the first fraction is always true we can set up a proportion n   m i c r o s e c o n d s p r o b l e m   o f   a n y   s i z e   n = 1   s e c o n d s p r o b l e m   o f   s i z e   n . So now we can solve the proportion for n

Do you have a similar question?

Recalculate according to your conditions!

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?