Question: Calculate the complexity (O(n)) of the following algorithm: void Program(int N) { int jumlah = 0; for (int i=N/2; i
Calculate the complexity (O(n)) of the following algorithm:
void Program(int N) { int jumlah = 0; for (int i=N/2; i<=N; i++) for (int j=1; j<=N; j = 2 * j) for (int k=1; k<=N; k = k * 2) jumlah++; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
