What is the range of input sizes for the following time complexities to compute an answer in no more than 1 second?
1 to ____ for each:
Solving for max possible value of n to produce an answer in 1 second
O(lgn)
O(square-root(n))
O(n)
O(n2)
O(n3)
Since it is known that atmost 10^7 lines are compiled in 1 second it is clear that
1 . n= very very large as log(n) is highly optimsed
logn=10^7 which means n=10^(10^7) which is extremely large.
2 . n=10^14 nearly for sqrt(n)
as n^1/2 =10^7 which is extreme case and hence n=(10^7)^2 which is nearly equal to 10^14.
3. n=10^7 nearly for n
as n^1 =10^7 which is extreme case and hence n=(10^7)^1 which is nearly equal to 10^7.
4. n= 10^3 for n^2
as n^2 =10^7 which is extreme case and hence n=(10^7)^1/2 which is nearly equal to 1000.
5. n=10^2 nearly for n^3
as n^3 =10^7 which is extreme case and hence n=(10^7)^1/3 which is nearly equal to 100.
If u feel any doubt feel free to ask
What is the range of input sizes for the following time complexities to compute an answer...
Q5 Match the following operations to their corresponding worst case time complexities Operations Finding the nert larger item in a Hash Table Time Complexities од) O (log n) O(n) O(n log n) O(n2) o(n3) O(n + m) O(m logn) O((n +m) log n) O(n2+nm) Trying to remove a non-eristing item from a Hash Table 2 3Finding the previous smaller item in a possibly unbalanced BST Updating a previous value into a new value in an AVL Tree Sorting m edges...
Please answer ASAP Thank You 1Consider an algorithm that requires the following number of operations (time units) for these input sizes (n). The algorithm is ___________ . Input size Operations 100 100,000 400 100,000 1600 100,000 Group of answer choices 1.O(n2) 2.O(n) 3.O(log n) 4.O(n3) 5.O(1) 2The below algorithm contains nested loops. for (int total = 1; total <= n; total++) { for (int samples = 0; samples < n; samples++) { for (int location = 1; location < 10;...
C. What is the running time for the following approaches to solving the max sum of a consecutive subset of the array? Approach 1. initialize the max sum to be the first element in the array for a subset of size 1 for each consecutive subset of that size, calc the sum of the subset if the subset is larger than the current max, update the current max repeat for subset sizes 2 through n Approach 2. Divide the array...
Please Help ASAP. 1Consider the below code which iterates over a linked list of n nodes (assume the list has at least 1 node). How many lines of output will it write? Node *thisNode = headPtr; while (thisNode != null) { cout << thisNode->item << endl; thisNode = thisNode->next; } 1.n 2.1 3.n2 4.n / 2 5.2 * n 2The below algorithm contains nested loops. for (int total = 1; total <= n; total++) { for (int samples = 0;...
Here are some common orders of growth, ranked from no growth to
fastest growth:
Θ(1) — constant time takes the same amount of time regardless
of input size
Θ(log n) — logarithmic time
Θ(n) — linear time
Θ(n log n) — linearithmic time
Θ(n2 ) — quadratic time
Θ(n3 ), etc. — polynomial time
Θ(2n), Θ(3n), etc. — exponential time
(considered “intractable”; these are really, really horrible)
In addition, some programs will never terminate if they get
stuck in an...
Problem 2 Consider the causal non-linear discrete-time system characterized by the following difference equation: 2y[n] yn-1]+x[n] /yn-] If we use as input x[n] to this system (algorithm) a step function of amplitude P (i.e. xIn]-P u[n]), then y[n] will converge after several iterations to the square root of P .Write a MATLAB program that implements the above recursion to compute the square . How many iterations does it take to converge to the true value starting at y[-1]-0.2? roots of...
Compute the total running time for each of the functions in the following code. First, compute the running time in terms of some constants a, b, c, d, e, etc. Show your work and give the answer in the text box. Then give the tightest big-O bound you can for each. (All of the functions are O(n!), but you can give a more informative bound for each.) void f(int n) { int i = 1; while (i <= sqrt(n)) {...
4. Big-Oh and Rune time Analysis: describe the worst case running time of the following pseudocode functions in Big-Oh notation in terms of the variable n. howing your work is not required (although showing work may allow some partial t in the case your answer is wrong-don't spend a lot of time showing your work.). You MUST choose your answer from the following (not given in any particular order), each of which could be re-used (could be the answer for...
Indicate whether the first function of each of the following pairs has a smaller, same or larger order of growth (to within a constant multiple) than the second function. Justify your answer (1) n(n2+1) and 2000 n2 + 34 n (2) ln n and lg n (3) 2n-1 and 2n (4) 2 n2 and 0.001 n3 – 2 n
Assume you are given two linear lists of size n each; consider the problem of determining whether any element of one list is an element of the other (not value, element). Derive a lower bound for this problem and design an algorithm for this problem. Derive its time complexity. It should be as close the lower bound as possible. My work so far: //Copy list n1 into n3 int n3[n]; for(int I = 0; I < n; i++)n3[i] = n1[i];...