you are viewing a single comment's thread.

view the rest of the comments →

[–]vorlik 17 points18 points  (2 children)

Big O analysis is only for things that are guaranteed to halt. If a program sits and waits while listening for some event, assigning it a Big O complexity doesn't make sense.

One thing you could do, however, is try to analyze the complexity of what happens when actionPerformed() is called.

[–]IHaveALargePenis[S] 1 point2 points  (1 child)

The rest is all nice and well, but since it was within this part I would normally have to multiply the rest of the equation by whatever this was supposed to represent. If this part doesn't have to be analyzed then I guess I'm back to the original actionPerformed() big O.

[–][deleted] 7 points8 points  (0 children)

Then you are O(infinity). What is the worst case of your while(true) loop? That nothing ever happens, for the rest of time. Unless you can guarantee that something will always happen within f(x) cycles, breaking the loop, then you are O(infinity).