F(n) = log n t = 1 seconds

In summary, the question is asking for the largest size n that can be solved in time t, given that the algorithm takes f(n) microseconds. The example provided has f(n) = log n and t = 1 second. To get the largest n, we need to find the value of n such that f(n) = 1,000,000 microseconds. Assuming log is base 2, we have n = 2^(10^6). However, if we want to use base 10, we can use the rule loga(Xy) = y.loga(X) to get n = 10^(10^6). This can also be written as 10^(300,000) or 10^6
  • #1
nuttynibbles
7
0
Hi,

I'm doing this algorithm questions and i need to find the largest size n of a problem that can be solved in time t, assuming that the algorithm to solve the problem takes f(n) microseconds.

For example:

f(n) = log n
t = 1 seconds

how do i get the largest size of n in t time??

what i did is assume log is base 10, then:

lg x = y
x= 10^y
since:
f(n) = 1,000,000 microseconds
n = 10^1,000,000

am i right??

you can refer to the Q here: http://problems.datastructures.net/database/problems/compare-running-times/compare-running-times.pdf
 
Mathematics news on Phys.org
  • #2


nuttynibbles said:
Hi,

I'm doing this algorithm questions and i need to find the largest size n of a problem that can be solved in time t, assuming that the algorithm to solve the problem takes f(n) microseconds.

For example:

f(n) = log n
t = 1 seconds

how do i get the largest size of n in t time??

what i did is assume log is base 10, then:

lg x = y
x= 10^y
since:
f(n) = 1,000,000 microseconds
n = 10^1,000,000

am i right??

you can refer to the Q here: http://problems.datastructures.net/database/problems/compare-running-times/compare-running-times.pdf

Well, first things first, you need to read the question a bit more carefully. The opening states clearly:

Note that log n means the logarithm in base 2 of n.

Other than that, you should be on the right track.
 
  • #3


oh my.. tks

if it's base 2, then:

lg2 x = y
x= 2^y
since:
f(n) = 1,000,000 microseconds
n = 2^1,000,000

but why is the ans 10^3000000??
 
  • #4


nuttynibbles said:
oh my.. tks

if it's base 2, then:

lg2 x = y
x= 2^y
since:
f(n) = 1,000,000 microseconds
n = 2^1,000,000

but why is the ans 10^3000000??

Do you mean 10300,000 as opposed to 103,000,000? If

[tex]2^{10^6}=10^x[/tex]

find x.
 
  • #5


sorry i meant 300,000

since:
2^(10^6) = 10^x
That means:
since x = 10^6, therefore 10^x = 10^(10^6). but how do i get the value 10^300000??
 
Last edited:
  • #6


nuttynibbles said:
sorry i meant 300,000

since:
2^(10^6) = 10^x
That means:
10^(2^(10^6)) correct. but how do i calculate the value 10^300000?? i'll get error on my calculator

Not... quite. You have to take the log base 10 to isolate x, and then you get 10^6 log_10(2), or about 1000000 * log_10(2). That's the x you're looking for, and it's easy to prove that it's about 300000. Then you get that 2^(10^6) is about equal to 10^(300000).
 
  • #7


hi char.limit, may i know which log rule define this??
 
  • #8


nuttynibbles said:
hi char.limit, may i know which log rule define this??

If

[tex]a^b=c[/tex]

then

[tex]b=\log_ac[/tex]

So can you apply this to your example?
 
  • #9


sorry but I am actually still confuse.. i don't really understand when char.limit said i can isolate x by taking log_10 of x and i get 106 . log_10 (2).

i change x->y to avoid confusion. since the rule says:
y = log_10 x, then x=10y

if we continue from
2106 =10y
then
y = log_10(2(106)) ?
but how did char.limit get log_10(2).106??
 
Last edited:
  • #10


Hi,

i finally understood. the rule that i was looking for is
loga(Xy) = y.loga(X)

therefore,
2106 =10y
y = 106 . log10(2)

However, i got another Q. if the Q was asked to use log2, must we give the final ans in log10??
 
  • #11


nuttynibbles said:
Hi,

i finally understood. the rule that i was looking for is
loga(Xy) = y.loga(X)

therefore,
2106 =10y
y = 106 . log10(2)
Yes, that's right :smile:

nuttynibbles said:
However, i got another Q. if the Q was asked to use log2, must we give the final ans in log10??

No, it's not necessary. I'd usually leave the answer as it is unless I was specifically asked to convert it into that form.
 
  • #12


hmm okay tks a lot peeps
 

1. What does the function F(n) = log n t = 1 seconds represent?

The function F(n) = log n t = 1 seconds represents the time it takes for a computer to perform an operation on a dataset of size n, where the operation is completed in 1 second.

2. How is the value of n related to the time t in this function?

The value of n is directly proportional to the time t in this function. As the size of the dataset n increases, the time it takes to complete the operation in 1 second also increases.

3. What is the significance of using logarithmic notation in this function?

The use of logarithmic notation in this function allows for a more efficient representation of large numbers. It also helps to visualize the relationship between the size of the dataset and the time it takes to complete the operation.

4. Can this function be used to predict the exact time it takes to perform an operation on a specific dataset?

No, this function cannot be used to predict the exact time it takes to perform an operation on a specific dataset. It only provides a general estimate based on the size of the dataset.

5. How can this function be applied in real-world scenarios?

This function can be applied in various real-world scenarios, such as analyzing the performance of algorithms or predicting the time it takes for a computer to process a certain amount of data. It can also be used to compare the efficiency of different methods for solving a problem.

Similar threads

Replies
3
Views
700
  • Precalculus Mathematics Homework Help
Replies
7
Views
820
  • General Math
Replies
2
Views
719
  • General Math
Replies
9
Views
1K
Replies
19
Views
2K
  • General Math
Replies
15
Views
2K
Replies
6
Views
1K
Replies
6
Views
2K
Replies
1
Views
9K
Replies
1
Views
772
Back
Top