0

Algorithm A divides the problem into 5 sub-problems of half the size. Solving each sub-problem then combining the solutions in linear time.

Algorithm B solves problems of size n by dividing them into 9 sub-problems of size n/3, and recursively solving each sub-problem then combines solutions in 26*n^2 time.

Algorithm C solves problems of size n by recursively solving two sub-problems of size n-1 then combines the solutions in constant time.

Questions:

What method would you use to compare these algorithms? Show how to apply said method.

What are the running times of each? which would you chose? Explain

When implemented, the algorithms may not perform as you ranked them for small input sizes, why can this be the case?

I know the following:

I think for A the recurrence recurrence relation is given by T(n) = 5T(n/2)+O(n) But is this what he means by what method I would use? and what does that make the running time of it?

LucasK
  • 11
  • Hello! We discourage posts that simply state a problem out of context, and expect the community to solve it. We do not want to just do your exercise or you; we want you to gain understanding. However, as it is we do not know what your underlying problem is, so we can not begin to help. You may want to check out our reference questions. I believe you will find that the answers to http://cs.stackexchange.com/questions/2789/ will show you how to get started on this exercise. – D.W. Oct 16 '15 at 03:18
  • @D.W. I added what I understand on there? did you read my entire post even? I know that it takes log(n) layers to be created and I know the recurrence relations but Im not sure how to answer the question. I want to know this stuff I have a terrible professor and he doesnt explain anything this has been a nightmare to learn on my own. – LucasK Oct 16 '15 at 03:32
  • As it stands, this question is not a good fit for our site format: 1. We want you to ask one question per question. You list three broad questions, which is too broad. 2. Just copy-pasting your exercise and adding one or two sentences is typically not received well here. You might try seeing if you can articulate a specific conceptual issue you're uncertain about? As a rule of thumb, a good conceptual question should be useful even to someone who isn't looking at the problem you happen to be working on. (continued) – D.W. Oct 16 '15 at 03:47
  • The answers to http://cs.stackexchange.com/questions/2789/ contain all of the techniques needed to answer the first question ("what method?") and the second question ("running times?"). Your next step should be to study that material and possibly our other reference questions and see how far you can get on your own. If you are still stuck, you can edit the question to address the concerns or post a new question, but do try to articulate a narrower question and make a serious effort to solve it on your own first and show us your attempts. See also http://cs.stackexchange.com/help/how-to-ask
  • – D.W. Oct 16 '15 at 03:49