Respuesta :
Answer:
The algorithm takes 346 ms to run on an input array with 1500 rows and 4096 columns.
Explanation:
For an input array with 1000 rows and 512 columns, the algorithm takes 173 ms.
We want to find out how long will the algorithm take to run on an input array with 1500 rows and 4096 columns?
Let the algorithm take x ms to run 1500 rows and 4096 columns.
For an input of n rows and m columns, it takes
[tex]n \: log_{2} \:m[/tex]
So,
[tex]1000 \: log_{2} \:512 = 173 \\\\1000 \: log_{2} \:2^{9} = 173 \:\:\: ( 2^{9} = 512) \\\\1000 \times 9 = 173 \:\:\:\:\: \: \: eg. 1[/tex]
and
[tex]1500 \: log_{2} \:4096 = x \\\\1500 \: log_{2} \:2^{12} = x \:\:\: ( 2^{12} = 4096) \\\\1500 \times 12 = x \:\:\:\:\: \: \: eg. 2[/tex]
Now divide the eq. 2 by eq. 1 to find the value of x
[tex]\frac{1500 \times 12}{1000 \times 9} = \frac{x}{173} \\\\\frac{18000 }{9000} = \frac{x}{173} \\\\2 = \frac{x}{173} \\\\x = 2 \times 173 \\\\x = 346 \: ms[/tex]
Therefore, the algorithm takes 346 ms to run on an input array with 1500 rows and 4096 columns.