95.5k views
5 votes
Three algorithms A, B, and C, are under consideration for the Insert operation of a particular data set. Through an analysis of these algorithms, their speed functions have been determined to be: Algorithm A: 23n + 36n 2 ; Algorithm B: 6 + n log2 (n ) + n ; Algorithm C: log2 n + 36n 2 .

Using Big-O analysis, calculate the value of each function.

User Ben Jacobs
by
7.7k points

1 Answer

0 votes

Using Big-O analysis, the value of each function are:

  • Algorithm A: O(n^2)
  • Algorithm B: O(n*log(n))
  • Algorithm C: O(n^2).

Algorithm A:

Speed function: 23n + 36n^2

Using Big-O notation, we focus on the dominant term, which is 36n^2.

So, the Big-O notation for Algorithm A is O(n^2).

Algorithm B:

Speed function: 6 + n*log2(n) + n

Using Big-O notation, we focus on the dominant term, which is n*log2(n).

So, the Big-O notation for Algorithm B is O(n*log(n)).

Algorithm C:

Speed function: log2(n) + 36n^2

Using Big-O notation, we focus on the dominant term, which is 36n^2.

So, the Big-O notation for Algorithm C is O(n^2).

User Npinti
by
8.0k points