I think he explained very clearly in the book. You should notice that when an element is added to the heap, there is no work done O(1) , the new element is just simply attached to the root, and the heap is only reorganized until an element is removed.( Look...

C[i+1] == 1 does a comparison, not an assignment.

python,algorithm,divide-and-conquer,clrs

Two really small mistakes: Your list i.e., t is of length 16. This means last index is 15. Thus call maxSubarray(t,0,15) not maxSubarray(t,0,16) while (j <= high). Loop until j<= high not until j<high Also with these two fixes, you don't need to set any default values to max_right or...

The answer that suggests running DFS from every node means you should stop the DFS once you cannot continue (no outgoing edges left), and not start from a different node. In this case, in your example, you will start (w.l.o) from 1, discover 2, and you are done. No back...

algorithm,math,greatest-common-divisor,number-theory,clrs

That pseudocode is not Pollard-rho factorization despite the label. It is one trial of the related Brent's factorization method. In Pollard-rho factorization, in the ith step you compute x_i and x_(2i), and check the GCD of x_(2i)-x_i with n. In Brent's factorization method, you compute GCD(x_(2^a)-x_(2^a+b),n) for b=1,2, ..., 2^a....

algorithm,math,infinite,clrs,gp

Yes, you have issues in your solution to the problem. While everything is correct in formulating the value of S, you have calculated the value of S1 incorrectly. You missed substituting the value for k=0 in S1. Whereas, for S, even after putting the value of k, the first term...