36.3k views
1 vote
Consider two algorithms that perform the same function, that run in n/4 and log2(n), respectively, where n ∈ N (i.e. natural numbers).(a) Plot these runtimes on the same graph with the values n ∈ [1, 50] (don’t forget labels). Provide the set of intervals over N, where n/4 is the strictly better algorithm to use (think greater than, not greater than or equal).

1 Answer

7 votes

Answer:

[2, 15]

Explanation:

The graph shows the n/4 algorithm to be better (smaller run time) for n in the range 2 to 15.

Consider two algorithms that perform the same function, that run in n/4 and log2(n-example-1
User Erwaman
by
8.3k points