in my c++ class i need help with these question please
Question 1. 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. Use the correct notation to indicate the order of growth (f(n) ∈O(g(n)), Ω(g(n)), or Θ(g(n)) as applicable). Prove your statement using limits. (a) (lnn)2 and lnn2 (b) 42n+1 and 42n
Question 2. Use the formal definitions of O, Ω, and Θ to prove the following: (a) lnn ∈ Θ(log2 n) (b) 100n3 ∈ Ω(n2)
Question 3. Order the following functions according to their order of growth from lowest to highest. Ties, if any, must be clearly stated. (a) log2 n10 (b) 6 √n (c) log2 n (d) (n + 1000)! (e) 3n (f) 1.93n (g) n8 1000 (h) n−6000 (i) 0.0001n2 + 105n (j) nlogn Question 4. For each of the following program fragments, give an analysis of the running time (Big-Oh will do). Give the exact value leading to the Big-Oh conclusion, and show your work. sum = 0; //1 for( i = 0; i < n; ++i ) ++sum; sum = 0; //2 for( i = 0; i < n; ++i ) for( j = 0; j < n; ++j ) ++sum; sum = 0; //3 for( i = 0; i < n; ++i ) for( j = 0; j < n * n; ++j ) ++sum;
Question 5. Define a Rectangle class that provides getLength and getWidth. Write a main that creates a vector of Rectangles and finds the largest Rectangle on the basis of area. For this part of the assignment, you need to submit a separate .cpp source code file as well as screenshots in your homework submission indicating successful testing of the code. No credit will be given for code that does not compile or segfaults.
Solution:
1 is solved as per the HOMEWORKLIB RULES, please repost others.
1)
a)
(log2n)2 and log2 n2
===> log22 n = log2 n * log2 n and
and
log2 n2 = 2 log n.
(According to the logarithmic property)
which means
b)
4^(2n+1) and 4^2n

I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)
in my c++ class i need help with these question please Question 1. Indicate whether the...
I need help for the order of growth for functions in Python 3. Q1: What is the order of growth for the following functions? Kinds of Growth Here are some common orders of growth, ranked from no growth to fastest growth: 1. Θ(1) — constant time takes the same amount of time regardless of input size 2. Θ(log n) — logarithmic time 3. Θ(n) — linear time 4. Θ(n log n) — linearithmic time 5. Θ(n2 ) 6. Θ(n3 ),...
This is java. I need help with my computer science class. Question 11 Assume that you have an array of integers named arr. The following program segment is intended to sum arr [0]through arr[n−1], where n = arr.length: sum = 0; i = 0; n = arr.length; while (i != n) { i++; sum += arr[i]; } In order for this segment to perform as intended, which of the following modifications, if any, should be made? 1.No modification is necessary...
Please DONOT attempt this Big O question if you don't know the exact answer. Algorithms question (Big O): Please explain me in details the order of growth (as a function of N) of the running times of each of the following code fragments: a) int sum = 0; for (int n = N; n > 0; n /= 2) for(int i = 0; i < n; i++) sum++; b) int sum = 0; for (int i =...
Need help with 1,2,3 thank you.
1. Order of growth (20 points) Order the following functions according to their order of growth from the lowest to the highest. If you think that two functions are of the same order (Le f(n) E Θ(g(n))), put then in the same group. log(n!), n., log log n, logn, n log(n), n2 V, (1)!, 2", n!, 3", 21 2. Asymptotic Notation (20 points) For each pair of functions in the table below, deternme whether...
I need help fixing my code: In C++ *************** 1) I want to sum the digits of an n*n matrix 2) find the average I have completed the rest ****Do not use C++ standard library. You must use pointers and pointer arithmetic to represent the matrix and to navigate through it. MY CODE: (I have indicated at which point I need help) #include <iostream> using namespace std; void swap(int *xp, int *yp) { int temp = *xp; *xp = *yp;...
**C++ Question** For all of the following, determine the total operation count and then the Big-O of the given code segments: a. for (int j = 0; j < n; j++) for (int k = 0; k < j; k++) sum++; b. for (int i = 0; i < q*q; i++) for (int j = 0; j < i; j++) sum++; For all of the following, just determine the Big-O of the given code segments: c. for (int i =...
1. (25 points) Assume each expression listed below represents the execution time of a program Express the order of magnitude for cach time using big O notation. a. T(n) = ns + 100n . log2 n + 5000 b. T(n) = 2" +n” + 7 d. T(n) 1+2+4+2 2 (75 points+5 extra credit) For cach of the code segments below, determine an equation for the worst-case computing time Tn) (expressed as a function of n, ie. 2n+4) and the order...
I need help with question 2, 3 and 4 please. Thanks in
advance.
Answer the following questions: 1. Prove that any polynomial of degree k is O (nk 2. By finding appropriate values ofc and no, prove that: f(n) 4 n log2 n + 4 n2 + 4 n iso(n2). 3. Find functions fi and fi such that both fi(n) and /i(n) are O(g(n)), but fi(n) is not OG(n)) 4. Determine whether the following statements are true or false. Briefly...
Question 3: Given the following two
code fragments [2 Marks]
(i)Find T(n), the time complexity (as
operations count) in the worst case?
(ii)Express the growth rate of the
function in asymptotic notation in the closest bound possible.
(iii)Prove that T(n) is Big O (g(n)) by
the definition of Big O
(iv)Prove that T(n) is (g(n)) by using
limits
8. R-4.8 Order the following functions by asymptotic growth rate. 4nlogn + 2n 2^10 2^logn 3n + 100logn 4n 2^n n^2 + 10n n^3 nlogn 9. R-4.9 Give a big-Oh characterization, in terms of n, of the running time of the example 1 method shown in Code Fragment 4.12. 10. R-4.10 Give a big-Oh characterization, in terms of n, of the running time of the example 2 method shown in Code Fragment 4.12. 11. R-4.11 Give a big-Oh characterization, in...