3 ms·
N^2 is just two nested loops. It trivially shows up everywhere you have 2D arrays. Do I really need to make my code spaghetti if the array sizes are small enou
by whatever1 1y ago
N^2 is just two nested loops. It trivially shows up everywhere you have 2D arrays.
Do I really need to make my code spaghetti if the array sizes are small enough to not impact my speed ?
- lurking_swe 1y agoif you can guarantee N is small, then it’s probably not an issue.
- Anon1096 1y agoIterating over a 2D array using nested loops is an O(N) operation. N is the size of your data, how it's represented in an array is irrelevant.