Describe the order of magnitude of the following code section using Big(O) notation
j = 1;
While (j < N)
{
j = j * 2);
}
Can someone give me a more Clearer answer please.
For the given while loop the order of magnitude is
O(N)
because the loop iterates is based on N value..
which means the while loop executes N number of times..
The Big O notation is used for determined algorithm how it is
responding to given input...
how fast if the input is small or big.
we use Big 0 Notation is verious like searching ,sorting
etc..
lets take some algorithm which takes list and input to search in
list
function(list,searchitem)
loop(from start to end)
searches for item
if founds returns true
or
else
goes till end and if not present it returns false
the complexity of above function is O(n)
O(N) is read as Order of N
O=> function is called function(order)
this is because we do approximations..called as order of
magnitude.
Order of Magnitude is generally used for differentiang different
classes of digits(numbers)
let us say difference between 1000 and 100000 is quite very
large..if done as long as order of magnitude you will be close to
it
in algorith O(N) to represent worst case..
suppose a list containing a 10000 elements and we want to search for 999th element..we can use different searching algorithms to find that element...and to anlaysis the bestcase,worstcase,average case different notations are there..o(n) it used for worst case complexity
Describe the order of magnitude of the following code section using Big(O) notation j = 1;...
Describe the order of magnitude of the following code section using Big(O) notation. k=0; for (i= 0; i<N; i++)
State the order of magnitude in Big-O notation (assuming there are N elements), and explain your answer in detail for the following operations. 2. Sorting an array using quick sort.
Provide the Big‐O notation for the following lines of Java code, make sure you include all the necessary steps to reach your answer to receive any credit: a. for (i = 10; i < n – 8; i++) { for( j = 1; j < m; j *= 2) x = i + j; } b. for(k = 0; k <= m; k += 2) { l = 0; while(l < n/2) { y = l * 4 – x;...
Find the best big-O notation to describe the complexity of following algorithms: The number of print statements in the following while n>1 { print “hello” n=n/2 }
In Big-Θ notation, analyze the running time of the following pieces of code/pseudo-code. Describe the running time as a function of the input size (here, n) for(int i=n-1; i >=0; i--){ for(int k=0; k < i*n; k++){ // do something that takes O(1) time } }
7. [4] (Big-O-Notation) What is the order of growth of the following functions in Big-o notation? a. f(N) = (N® + 100M2 + 10N + 50) b. f(N) = (10012 + 10N +50) /N2 c. f(N) = 10N + 50Nlog (N) d. f(N) = 50N2log (n)/N
1. Determine the appropriate big-o expression for each of the following functions, and put your answer in the table we have provided in section 2-1 of ps5_parti. We've included the answer for the first function. (Note: We're using the “ symbol to represent exponentiation.) a (n) = 5n + 1 b. b(n) = 5 - 10n - n^2 o c(n) = 4n + 2log (n) d. e. d(n) = 6nlog (n) + n^2 e(n) = 2n^2 + 3n^3 - 7n...
Using C++ please explain What is the Big-O time complexity of the following code: for (int i=0; i<N; i+=2) { ... constant time operations... Select one: o a. O(n^2) O b. O(log n) c. O(n) O d. 0(1) What is the Big-O time complexity of the following code: for(int i=1; i<N; i*=2) { ... constant time operations... Select one: O O a. O(n^2) b. 0(1) c. O(n) d. O(log n) O What is the Big-O time complexity of the following...
Please specify Time and Space Complexities in terms of the Big-O notation. for (int j = 1; j < n; j = 2 * j) sum += j; Question 8 options: O(n^2) O(n log n) O(log n) O(n) O(1)
Analyze the following code fragments and write down the Big-O estimates of the following code fragments. Provide a concise explanation how you got your answer. c. for (int j = 0; j < n; j++) { for (int k = 0; k < n; k++) cout << (j + k) << endl; } d. while (n > 1) { k += n *3; n = n / 2; } e. int temp = n; for (int j...