title: Complexity of algorithm implementing Newton's method in finding square root
body: <p>I have written a Java program to calculate the square root of a user-defined number using Newton's method. The main operations of the algo goes like that:</p>
  
  <pre><code>answer = guess - ((guess * guess - inputNumber) / (2 * guess)); 
  while (Math.abs(answer * answer - inputNumber) &gt; leniency) {
      guess = answer;
      answer = guess - ((guess * guess - inputNumber) / (2 * guess));
  }
  </code></pre>
  
  <p>I'm now seeking to find the complexity of the algorithm (yup it's homework), and have read up from <a href="https://stackoverflow.com/questions/5005753/what-is-newton-raphson-square-methods-time-complexity">here</a> that the time complexity of Newton's method is O(log(n) * F(x)).</p>
  
  <p>However, from the above code snippet, I have interpreted the time complexity to be:</p>
  
  <pre><code>O(1+ ∑(1 to n) (1) ) = O(1+n) = O(n)
  </code></pre>
  
  <p>Not sure what I'm getting wrong here, but I can't seem to understand the disparity in big Os even after reading wiki's explanation. </p>
  
  <p>Also, I am assuming that "complexity of algorithm" is synonymous to "time complexity". Is it right to do so?</p>
  
  <p>Would really appreciate help in explaining this paradox, as I'm a newbie student with a few 'touch and go' programming modules worth of background. </p>
  
  <p>Thanks in advance :)</p>