I mean, is:
for(..){
for(..){
}
}<p>better than
for(..){}
for(..){}
?<p>May it be in terms of running time, memory, etc.
This may be a dumb question, if so, i'm sorry.
It's not a dumb question, this idea is covered at the beginning of every data structures class and is described as Big O Notation.<p>The difference is the growth rate.<p>for(..){} for(..){} will grow linearly, or O(n).<p>Iterating over 10 items will be 20 loops, while iterating over 11 items will only be 22 loops.<p>for(..){ for(..){ } } grows exponentially, or O(n^2)<p>Here iterating over 10 items will be 100 loops, and increasing n by 1 (to 11) results in 121 loops.<p>Typically it preferably to user O(n) over O(n^2).<p>This probably explains it better than I can: <a href="http://rob-bell.net/2009/06/a-beginners-guide-to-big-o-notation/" rel="nofollow">http://rob-bell.net/2009/06/a-beginners-guide-to-big-o-notat...</a>