Praxis Core Academic Skills for Educators: Mathematics (5733)Algebra and FunctionsMedium
A software engineer is optimizing an algorithm. The runtime T (in milliseconds) of the algorithm for an input of size n is given by the function T(n) = 3n^2 + 5n - 2. What is the difference in runtime between an input of size n=5 and an input of size n=3?
- A46 milliseconds
- B58 milliseconds
- C70 milliseconds
- D82 milliseconds
Show answer & explanationAnswer & explanation
Correct answer: D. 82 milliseconds
To find the difference, first evaluate the function for n=5 and n=3 separately. Then, subtract the runtime for n=3 from the runtime for n=5.
Why the other options are wrong
- A. Made an error in calculation for T(5) or T(3).
- B. Incorrectly calculated T(5) - T(3).
- C. Incorrectly calculated T(5) - T(3).
Function Evaluation and Difference
Determining the output of a function for specific input values and then finding the difference between those outputs.
- Substitute the input value directly into the function.
- Perform all arithmetic operations correctly.
- The difference is found by subtracting the two resulting function values.
Memory trick: Plug it in twice, then subtract the price.