0

I have this function

int fct (int Y){
        int y = 0 ;
        for ( int i =0; i<Y;++ i ){
            for ( int j=i ; j >=0;--j ){
                y++;
                }
            }
            return y ;
    }

I want to know the order of this function, I know that the first for loop its O(n), but I confused to the second for lood, I'm not sure if is O(n).

I think the order of function its O(n^2)

Any help?

Raphael
  • 73,212
  • 30
  • 182
  • 400
Jhonny
  • 1

0 Answers0