Difference of complexity between double nested for loops? (Java)
What's the difference in terms of performance and complexity between these
two nested for loops?
for(int i = 0; i < l.length; i++) {
for(int j = 0; j <= i; j++) {
//do something
}
}
and :
for(int i = 0; i < l.length; i++) {
for(int j = 0; j < l.length; j++) {
//do something
}
}
No comments:
Post a Comment