# Bit operations algorithm question

• Feb 16th 2010, 12:39 PM
Runty
Bit operations algorithm question
Suppose that an algorithm uses $3n^2+2^n$ bit operations to solve a problem of size $n$.

Suppose that your machine can perform one bit operation in $10^{-9}$ seconds, how long does it take your algorithm to solve a problem of size given below.

Note, if your algorithm takes more than 60 seconds, answer in minutes. For more than 60 minutes, answer in hours. For more than 24 hours, answer in days. For more than 365 days, answer in years. For more than 100 years, answer in centuries.
a) 10
b) 20
c) 50
d) 100

Our class has been taught nothing so far concerning algorithm size, so I really need help on this. I've listed the question word for word.
• Feb 16th 2010, 12:52 PM
Surely subbing in the n value will give you total amount of bit operations need then multiplying by 10^-9 will give you the amount of seconds it takes.

Ex.

for n = 100 you get...

$3 \cdot 100^2 + 2^{100} = 1267650600228229401496703235376$ bit operations.

Multiply by 10^-9 to get roughly $1.2676 \times 10^{21}$ seconds.

By the way I got that to be $4.01969368413314759 \times 10^{11}$ centuries!
• Feb 16th 2010, 01:10 PM
Runty
Quote:

$3 \cdot 100^2 + 2^{100} = 1267650600228229401496703235376$ bit operations.
Multiply by 10^-9 to get roughly $1.2676 \times 10^{21}$ seconds.
By the way I got that to be $4.01969368413314759 \times 10^{11}$ centuries!