14,603,215 members

See more:

Q1. What is the Big-O notation of the following algorithm (assume that all variables have been declared): for (int i=1; i<= n; i++) sum = sum + i * (i + 1); Q2. What is the Big-O notation of the following algorithm (assume that all variables have been declared): for (int i = 5; i <= 2 * n; i++) System.out.println(2 * n + i - 1); Q3. What is the Big-O notation of the following algorithm: for (int i = 1; i <= 2 * n; i++) for (int j = 1; j <= n; j++) System.out.println(2 * i + j); System.out.println(“ “); Q4. What is the Big-O notation of the following algorithm: for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) for (int k = 1; k <= n; k++) System.out.println(i + j + k); Q5. Each of the following expressions represents the number of inputs for certain algorithms. Write them in Big O notation (e.g, n + 2 -> O(n)): - n2 + 6n + 4 - 5n3 + 2n + 8 - (n2 + 1)(3n + 5) - 5(6n + 4) - n + 2log2n - 6 - 4nlog2n + 3n + 8

What is the Big-O notation of the following algorithm

Comments

What are your answers ?

We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!

Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!

Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject,
503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada
+1 416-849-8900 x 100