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

Discrete Math. I answered the one. can you answer the 2nd and 3rd one. big O or

ID: 3197683 • Letter: D

Question

Discrete Math. I answered the one. can you answer the 2nd and 3rd one. big O or big theta if they're different but i dont think they are.

3.3 Give big-Theta estimates for the number of comparisons in the following algorithms procedure matrix-max (A: an nx nmatrix with integer entries) for row- 1 to n for col = 1 to n if A(row.col)> max then max- A(row.col) return max row.c) gives eniry in matris with given row and colum procedure some-procedure 1(some inputs) for i=0 to n-1 for j= n to i +1 step-1 some comparison return something procedure some-procedure asome inpuis) for i- 0 to n-1 for j-I to 100 some conmparison return something

Explanation / Answer

2. There are 2 for loops and in the worst case, they will both execute about n times.

=> Efficiency = O(n2)

3. There are 2 for loops. The first one executes n times and the second one 100 times each.

Therefore, the two loops execute 100n times.

=> Efficiency = O(n).

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