I'm drowning in PHP

David Cantrell david at cantrell.org.uk
Tue May 15 13:51:50 BST 2007


On Tue, May 15, 2007 at 02:09:50PM +0200, mirod wrote:
> >>>>      for($i=0; $i<strlen($str); $i++) {
> >>> Ah, the classic O(n^2) for loop.
> > That and the fact that it's not actually N^2 :)
> Well, it is if strlen($str) is O(N), as it might well be in C for example.

Depends on whether, and how, strlen($str) changes.  If it doesn't, then
it's just a (potentially large) constant.

-- 
David Cantrell | top google result for "topless karaoke murders"

Please stop rolling your Jargon Dice and explain the problem
you are having to me in plain English, using small words.
  -- John Hardin, in the Monastery


More information about the london.pm mailing list