How should I express the complexity of two nested loops

I know the complexity of two for loops like that is x^2

for(i;i<x;i++){
   for(j;j<x;y++){
      //code
   }
}

but how about the complexity of two for loops while the nested one depends on the value of the first one, like that :

So I know that the time complexity of:

for(i; i<x; i++){
   for(y; y<i; y++){
      //code
   }
}

is the sum of integers of i as in the famous n(n+1)/2



from Recent Questions - Stack Overflow https://ift.tt/32Kh9ol
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation