Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Ture or false. 1. The GenLoop algorithm, which finds the nth element of a recurr

ID: 3793162 • Letter: T

Question

Ture or false.

1. The GenLoop algorithm, which finds the nth element of a recurrence relation with k weights, is O(n · k).

2. The best algorithm for finding the most-frequent word in a paragraph is O(n log n), because there is a simple O(n) solution method when we assume that the list of words is sorted into alphabetical order.

3. If its running time is T(n) = 13n 2 + 9 for problem size n, then the algorithm is (n) but not O(n).

4. The following sequence of statements int a[10]; int *b = a; *(b+2) = 12; assigns 12 to a[2].

5. If the array from a[1] to a[n] is a binary heap, then a[7] cannot be its third-smallest element.

6. The statement vector> test; creates a vector of objects, each of which is a vector of Fraction items.

7. If you execute the statement ofstream myfile ("example.txt"); then cout << "Hello world!"; would send its greeting to the the file named “example.txt” instead of the standard output.

Explanation / Answer

1.False
2.False. Hashing is the best solution.


3. O(x) denotes an upper bound, but this bound might or might not be tight.

(x) denotes a lower bound, but this bound might or might not be tight.

if its 13*n^2+ 9 then its lower bound can be (n) but upper bound will be O(n^2)

else if its 13*n*2 + 9 then lower bound can be (n) but upper bound will be O(n)

4.  True

5. It needs to be specifed whether its a min Heap or Max Heap. Then we can answer this.

6. This statement " vector> test" won't create a vector of objects. False


7. False.

If you use

then it will be printed in the file.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote