Hi all, I am an absolute beginner to data structures and algorithms. The book that our class is using isn't all that helpful or perhaps I am not digesting the information that well. It is early in the semester and I am already struggling, so I am really hoping that someone is able to help me understand these topics better.

An exercise asks us to give the big-Oh characterization, in terms of n, of the worst-case running time of Algorithm 1 (below) and the best-case running time.

Code:
Algorithm 1
Let A be a given array of n integers

for i<-0 to n-1 do
     if (A[i] = 0) then
          for j<-0 to i do
               A[i] <- A[i] + A[j]
Like I said, I am completely new to this topic and am having a difficult time understanding the material. The best I have managed to do is just to turn the algorithm into code like so:

Code:
for (i = 0; i<n; i++) {
     if (A[i] = 0) {
          for (j = 0; j<i+1; j++) {
               A[i] = A[i] + A[j];
          }
     }
}
Would love it if someone could explain how to go about solving this problem in detail so that I can apply the same knowledge to some of the other exercises. Thanks in advance.