4 ms·
> who wrote nested loops What is this supposed to be the connotation here?
by sicp-enjoyer 4y ago
> who wrote nested loops
What is this supposed to be the connotation here?
- SauciestGNU 4y agoThis suggests runtime complexity will be O(n^2), which is rarely an optimal solution to a problem.
- comex 4y agoPerhaps, but “nested loops” by itself is an odd way to describe that.
- jackblemming 4y agoUnless they verify the source code of every library they use and verify the entire call stack; it probably has a nested for loop somewhere. Good thing computers are fast!
- silvertaza 4y agoDepending on n, oftentimes nested loops are more readable and maintainable than the optimal solution. Of course too many levels of nesting is inherently a code smell that indicates other issues.
- strikelaserclaw 4y agothat says nothing if you don't know the size of the input and the problem at hand. Sometimes the best you can do is N^2.
- sicp-enjoyer 4y agoSome common cases (that wouldn't be considered algorithms) are: - working with grids (rows and columns) - iterating over nested data structures (eg. all people in a group).
- edgyquant 4y agoThat there’s almost always a more optimal solution than a triple nested loop in a useEffect. Any senior level engineer should be architecting said optimal solutions