Write a function F(n) which returns the total number of operations (additions an
ID: 3638511 • Letter: W
Question
Write a function F(n) which returns the total number of operations (additions and assignments) done on the variable sum. Use Big-O asymptotic notation to classify each of these algorithms with respect n. Assume that int sum = 0.(a) for (int i = 0; i < n; i++) sum = sum + 4;
(b) for (int i = 0; i < 2*n; i++)
for (int j = 0; j < 2 * n; j++)
sum = sum + 1;
(c) for( int i = 0; i < n; i++) sum = sum + 1;
for( int j = 0; j < n; j++) sum = sum + 1;
(d) for (int i = 1; i < n; i*=4) sum = sum + 1;