View the step-by-step solution to:

Write a recurrence relation that describes the running time of the following (not very smart) algorithm. The input is an array, A, and some constant...

Can anyone explain how you actually arrive with the following recurrence relation for this question?




Screen Shot 2018-04-03 at 1.23.55 pm.jpg






I know for n<= k it's O(1) since it's just returning the array but how do you get the bottom part?

Screen Shot 2018-04-03 at 1.23.55 pm.jpg

Write a recurrence relation that describes the running time of the following (not very smart) algorithm. The input is
an array, A, and some constant integer k. Assume a comparison based sort in Step 2. my_divide_and_conquer(A, k)
0. Let n be the number of elements in A
. If n &lt;= k, return A
. Sort A.
. Copy A[k..n-1] into a new array C
. Call my_divide_and_conquer(C, k) I-DUJMH 0(1) ifn g k T(n — k) + O(n log n) otherwise

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question