Friday, September 10, 2010

Compute the Max

 define o_max and assign i_intaryTb[0];
  looping from 0 to i_intaryTb.length -1 ,index += i_one_stepLength
      if ( index >= i_intaryTb.length ) then
          break the looping;
      if ( i_intaryTb[index] > o_max ) then
          o_max = i_intaryTb[index];
      end if
  end looping
  return o_max;


So, I got a lot of help with this from my friend Google. I'm not necessarily anywhere near good at programming, but it seems that I can understand this enough to argue that it will terminate and produce the correct results. 

i is assigned the length once it reaches i it stops. 

it will keep going until the max is found, or i is reached.


Phoenix AZ Marketing


2 comments:

  1. Nice. Good algorithm. I can understand it.

    You did argue about the finiteness of the algorithm, however, there an algorithm must also be accompanied with a proof of correctness.

    -Aviral

    ReplyDelete
  2. I will try to prove it's correctness, I'm really new at this.

    ReplyDelete