r/badcode • • Dec 20 '16

c Is point inside rectangle? Now O(n^2).

Post image
333 Upvotes

72 comments sorted by

View all comments

0

u/[deleted] Dec 20 '16

[deleted]

12

u/tias Dec 20 '16

You're not wrong. But it all depends what your definition of n is. In this case you really have O(w*h), but the limit as w and h both tend to infinity is the same as O(n*n).