<div class="gmail_quote">On Mon, Jan 26, 2009 at 01:04, Matthew J. Williams <span dir="ltr"><<a href="mailto:matthewjwilliams1@googlemail.com">matthewjwilliams1@googlemail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Dear all,<br>
<br>
In general terms, how would one calculate the time complexity of a given algorithm?</blockquote><div><br></div><div>I would count most significant operations. The result is Theta(n^2) (see <a href="http://en.wikipedia.org/wiki/Big_O_notation">http://en.wikipedia.org/wiki/Big_O_notation</a> for definition of Big Theta notation).</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"> Feel free to make use of my pseudo code in your answer:<br>
<br>
/* input:<br>
2-D array A of size n by n<br>
output: a number max */<br>
Max := 0<br>
For i := 1 to n<br>
sum := 0<br>
For j := 1 to n<br>
sum := sum + A[i][j]<br>
End for<br>
If sum > max then max := sum<br>
End for<br>
Output max<br>
<br></blockquote><div><br></div><div>Christopher Skrzętnicki </div></div>