(TCO 4) Order the following functions according to their growth rates from faste
ID: 3851497 • Letter: #
Question
(TCO 4) Order the following functions according to their growth rates from fastest to slowest.
I need help with this badly need to score 100 % only have 1 hour 1/2 left to submit Please!!!!!!!!! Help quickly
f(n) = n2
g(n) = 1
h(n) = n log n
(Points : 5)
TCO 3) Suppose q is a queue of integers in the program below.
q.enqueue(6);
q.enqueue(5);
q.dequeue();
System.out.println(q.getFront());
What is the value displayed by the System.out.println statement? (Points : 5)
(TCO 1) Show an application or a situation in which it is convenient to use an array to store the data of the application. (Points : 15)
(TCO 2) Suppose you know that binary search is to be implemented to search a data set. Would you use a linked list to store the data? Why yes? Why not? (Points : 15)
TCO 5) Consider the following array. Suppose that the array will be sorted using quicksort.
location
0
1
2
3
4
5
6
7
8
9
array[location]
16
12
21
10
2
7
26
25
13
8
If the initial pivot is 7, what will be the location of the pivot after the first iteration of the algorithm is completed? Why? (Points : 15)
(TCO 6) Suppose you have to implement a search algorithm in a high programming language such as Java or C++. You are given a linked list which is not sorted and it’s rather small, in the order of a few dozen elements. You expect that your algorithm will be run only once. Which search method would you use: sequential, sorted, or binary? Why? Please consider in your analysis if you would sort the array before running the search algorithm. (Points : 15)
(TCO 8) Write a C++ function maximum. This function is passed a vector<int > parameter and returns the largest value stored in the array list. Write an additional code fragment to test this function. Include any declarations and initialization statements necessary to test the function. (Points : 20)
f(n) = n2
g(n) = 1
h(n) = n log n
Explanation / Answer
(TCO 4) Solution-
If we are talking about the growth rate of a function then the function which tends to provide larger outcome is the come really matter and it is the most dominant one if we are talking about the growth rate as n^2 provides large outcome in comparison to n or nlogn.
So,if we are considering the situation of the problem the growth rate of f(n) is faster in comparison to growth rate of h(n) and growth rate of h(n) is faster as compare to g(n).
Note-For other questions to be answered please provide as seprate questions .
Thankyou
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.