Hacker News new | ask | show | jobs
by billybob 5427 days ago
You're right - it wasn't O(n^2); the number of operations was (Number of checkboxes) x (Number of products). So with 10 checkboxes and 200 products, I had 2000 operations. 201 products = 2010 operations.

My problem would have been N^N if I had been doing "for every checkbox... for every checkbox" instead of "for every checkbox... for every product..."

So it wasn't n^2, but it was scaling poorly.

The way I rewrote it, I had (Number of products) operations. So for 200 products, I had 200 operations.

You can see that this made it much more tenable to add 100 more products, even if it wasn't N^2.