writing script

1 view (last 30 days)
ferhat
ferhat on 4 Dec 2011
Problem: The dependence of the execution time of an algorithm to the length of input vector.
2 , N=1
T(N)=
3*T(N/2)+2 , N>=2
I need to write a script that solves problem with any input??
  3 Comments
bym
bym on 4 Dec 2011
What is T(N)=3*T(N/2)+2 supposed to return when N=3,5,7... ?
Walter Roberson
Walter Roberson on 4 Dec 2011
Isn't T(N) supposed to indicate the execution time of the unknown algorithm that has yet to be written? For example, the answer to the question might be something like a function that combines a bubble-sort with a half-linear operation so that the total time for input size N to the invented algorithm is given by T(N). If so then there is no problem with having 1/2 in the order of magnitude ("Big O") expression.
I'm wondering if the T(N/2) is intended to be T^(N/2), or T*(N/2)? But T at index N/2 is a plausible guess as well. That would make the question more interesting -- though inventing an algorithm that has to match a particular run-time pattern would be tricky enough for most assignments.

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!