I am currently analyzing maximum subarray problem for both brute-force algorithm and divide and conquer algorithm (recursive).
Using the brute-force algorithm, the worst-case runtime is O(n^2). Using the recursive algorithm, the worst-case runtime is O(n*log(n)).
But the brute-force is actually faster for small input up to a certain constant, say k, so I thought to use the brute-force up to k, then recursive afterward.
I'm not sure how to analyze this one, i.e. by using the parameter n and k. (There's a similar problem for Insertion/Merge sort where it takes O(k^2*(n/k))=O(n*k), so I thought I could use the same result but...).
Let me try to reformulate, and lets use the theta-notation.
"What's the asymptotic runtime of the algorithm with brute-force within recursive (use n and k as parametre), where brute force is faster than recursive up to k = 50."
I have to include both parameter n and k on it, and recursion-tree is the only subject we have had so far to test these problems.