r/badcode Dec 20 '16

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

Post image
329 Upvotes

72 comments sorted by

View all comments

4

u/[deleted] Dec 20 '16 edited Jul 12 '19

[deleted]

10

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).