Relative Content

Tag Archive for algorithm

How to Write a recurrence relationship for the algorithm described

(b) An algorithm process an array of size n in two parts, A and B of equal size. Part A is processed recursively, one element at a time, until a single element remains. Part B is processed recursively by dividing it into three equal parts until it is no longer divisible.
(i) Write a recurrence relationship for the algorithm described above.
(ii) Solve the recurrence relation using the substitution method. Clearly show the steps in the computation.

Algorithms the comparsion of function

I’m learning algorithms from abdul bari videos and I’m confused about something in the context of function comparsion if f(n) = 3n^(√n) and g(n) = 2^((√n)log(n))

Launch order and delay times to make operations finish in a desired order

Let’s say I have three operations that each take different time to complete:
“hack” takes 10 seconds
“grow” takes 20 seconds
“weaken” takes 30 seconds
I want to launch these operations in such a way that they finish one after another in a specified order. For example I want grow to finish first, followed immediately (Realistically with a small delay like 200ml) by hack finishing, and then weaken finishing. Is there some kind of algorithm I can follow to figure out in which order I should launch my operations and how long to wait before launching each operation?