

This cannot always be done...
It can be done if you have obtained the exact solution
If you have used approximation of simplification to obtain the solution, the answer cannot be checked... only "estimated" (the highest order terms will match, the lower order terms will not match)

for ( i = 0; i < N; i++) do_marker(); i = 0 1 2 3 ... n1 # do_marker(): 1 1 1 1 ... 1   ++ amount of work done = C_{n1} 
C_{n} = C_{n1} + 1 Rewrite using: n => n1 C_{n} = C_{n1} + 1 C_{n1} = C_{(n1)1} + 1 C_{n1} = C_{n2} + 1 C_{n} = (C_{n1} + 1) + 1 = C_{n2} + 1 + 1 Rewrite using: C_{n2} = C_{n3} + 1 C_{n} = (C_{n3} + 1) + 1 + 1 = C_{n3} + 1 + 1 + 1 Rewrite using: C_{n3} = C_{n4} + 1 C_{n} = (C_{n4} + 1) + 1 + 1 + 1 = C_{n4} + 1 + 1 + 1 + 1 and so on... 


C_{n} = C_{n1} + n ^^^^^ ^^^^^^ ^^^^^ Amount of work Amount of work Amount of work needed to solve needed to solve DONE to reduce a problem of a problem of problem size from size(n) size(n1) n to n1 
In other words:

Example of such type of algorithm: inserting sort (discussed later)
C_{n} = C_{n1} + n Rewrite using: n => n1 C_{n} = C_{n1} + n C_{n1} = C_{(n1)1} + (n1) C_{n1} = C_{n2} + (n1) C_{n} = (C_{n2} + (n1)) + n = C_{n2} + (n1) + n Rewrite using: C_{n2} = C_{n3} + (n2) C_{n} = (C_{n3} + (n2)) + (n1) + n = C_{n3} + (n2) + (n1) + n Rewrite using: C_{n3} = C_{n4} + (n3) C_{n} = (C_{n4} + (n3)) + (n2) + (n1) + n = C_{n4} + (n3) + (n2) + (n1) + n and so on... 


for ( i = 0; i < N; i++ ) for ( j = 0; j < N; j++ ) do_marker(); // Marker operation 
C_{n} = C_{n1} + 2n  1 Rewrite using: n => n1 C_{n} = C_{n1} + 2n  1 C_{n1} = C_{(n1)1} + 2(n1)  1 C_{n1} = C_{n2} + 2(n1)  1 C_{n} = (C_{n2} + 2(n1)  1) + 2n  1 = C_{n2} + (2(n1)1) + (2n1) Rewrite using: C_{n2} = C_{n3} + 2(n2)  1 C_{n} = (C_{n3} + 2(n2)  1) + (2(n1)1) + (2n1) = C_{n3} + (2(n2)1) + (2(n1)1) + (2n1) Rewrite using: C_{n3} = C_{n4} + 2(n3)  1 C_{n} = (C_{n4} + 2(n3)  1) + (2(n2)1) + (2(n1)1) + (2n1) = C_{n4} + (2(n3)1) + (2(n2)1) + (2(n1)1) + (2n1) and so on... 

C_{n} = C_{n/2} + 1 ^^^^^ ^^^^^^ ^^^^^ Amount of work Amount of work Amount of work needed to solve needed to solve DONE to reduce a problem of a problem of problem size from size(n) size(n/2) n to n/2 
In other words:

This can be achieved using the following substitution:

We have:
C_{n} = C_{n/2} + 1 n = 2^{k} ==> C_{2k} = C_{2k/2} + 1 <==> C_{2k} = C_{2k1} + 1 
C_{2k} = C_{2k1} + 1 Rewrite using: k => k1 C_{2k} = C_{2k1} + 1 C_{2(k1)} = C_{2(k1)1} + 1 C_{2k1} = C_{2k2} + 1 C_{2k} = (C_{2k2} + 1) + 1 = C_{2k2} + 1 + 1 Rewrite using: C_{2k2} = C_{2k3} + 1 C_{2k} = (C_{2k3} + 1) + 1 + 1 = C_{2k3} + 1 + 1 + 1 Rewrite using: C_{2k3} = C_{2k4} + 1 C_{2k} = (C_{2k4} + 1) + 1 + 1 + 1 = C_{2k4} + 1 + 1 + 1 + 1 and so on... 


C_{n} = C_{n/2} + n ^^^^^ ^^^^^^ ^^^^^ Amount of work Amount of work Amount of work needed to solve needed to solve DONE to reduce a problem of a problem of problem size from size(n) size(n/2) n to n/2 
In other words:

This can be achieved using the following substitution:

We have:
C_{n} = C_{n/2} + n n = 2^{k} ==> C_{2k} = C_{2k/2} + 2^{k} <==> C_{2k} = C_{2k1} + 2^{k} 
C_{2k} = C_{2k1} + 2^{k} Rewrite using: k => k1 C_{2k} = C_{2k1} + 2^{k} C_{2(k1)} = C_{2(k1)1} + 2^{k1} C_{2k1} = C_{2k2} + 2^{k1} C_{2k} = (C_{2k2} + 2^{k1}) + 2^{k} = C_{2k2} + 2^{k1} + 2^{k} Rewrite using: C_{2k2} = C_{2k3} + 2^{k2} C_{2k} = (C_{2k3} + 2^{k2}) + 2^{k1} + 2^{k} = C_{2k3} + 2^{k2} + 2^{k1} + 2^{k} Rewrite using: C_{2k3} = C_{2k4} + 2^{k3} C_{2k} = (C_{2k4} + 2^{k3}) + 2^{k2} + 2^{k1} + 2^{k} = C_{2k4} + 2^{k3} + 2^{k2} + 2^{k1} + 2^{k} and so on... 


C_{n} = 2 C_{n/2} + n ^^^^^ ^^^^^^^^ ^^^^^ Amount of work Amount of work Amount of work needed to solve needed to solve DONE to reduce a problem of two problems of problem size from size(n) size(n/2) n into 2 groups of n/2 items 
In other words:

Example algorithm: Quick Sort (discussed later)
This can be achieved using the following substitution:

We have:
C_{n} = 2C_{n/2} + n n = 2^{k} ==> C_{2k} = 2C_{2k/2} + 2^{k} <==> C_{2k} = 2C_{2k1} + 2^{k} 
C_{2k} = 2C_{2k1} + 2^{k} Rewrite using: k => k1 C_{2k} = 2C_{2k1} + 2^{k} C_{2(k1)} = 2C_{2(k1)1} + 2^{k1} C_{2k1} = 2C_{2k2} + 2^{k1} C_{2k} = 2×(2C_{2k2} + 2^{k1}) + 2^{k} = 2^{2}×C_{2k2} + 2×2^{k1} + 2^{k} = 2^{2}×C_{2k2} + 2^{k} + 2^{k} Rewrite using: C_{2k2} = 2C_{2k3} + 2^{k2} C_{2k} = 2^{2}×(2C_{2k3} + 2^{k2}) + 2^{k} + 2^{k} = 2^{3}×C_{2k3} + 2^{k} + 2^{k} + 2^{k} Rewrite using: C_{2k3} = 2C_{2k4} + 2^{k3} C_{2k} = 2^{3}×(C_{2k4} + 2^{k3}) + 2^{k} + 2^{k} + 2^{k} = 2^{4}×C_{2k4} + 2^{k} + 2^{k} + 2^{k} + 2^{k} and so on... 


C_{n} = 2 C_{n/2} + 1 ^^^^^ ^^^^^^^^ ^^^^^ Amount of work Amount of work Amount of work needed to solve needed to solve DONE to reduce a problem of two problems of problem size from size(n) size(n/2) n into 2 groups of n/2 items 
In other words:

This can be achieved using the following substitution:

We have:
C_{n} = 2C_{n/2} + 1 n = 2^{k} ==> C_{2k} = 2C_{2k/2} + 1 <==> C_{2k} = 2C_{2k1} + 1 
C_{2k} = 2C_{2k1} + 1 Rewrite using: k => k1 C_{2k} = 2C_{2k1} + 1 C_{2(k1)} = 2C_{2(k1)1} + 1 C_{2k1} = 2C_{2k2} + 1 C_{2k} = 2×(2C_{2k2} + 1) + 1 = 2^{2}×C_{2k2} + 2 + 1 Rewrite using: C_{2k2} = 2C_{2k3} + 1 C_{2k} = 2^{2}×(2C_{2k3} + 1) + 2 + 1 = 2^{3}×C_{2k3} + 2^{2} + 2 + 1 Rewrite using: C_{2k3} = 2C_{2k4} + 1 C_{2k} = 2^{3}×(C_{2k4} + 1) + 2^{2} + 2 + 1 = 2^{4}×C_{2k4} + 2^{3} + 2^{2} + 2 + 1 and so on... 
