reset password
Author Message
marrawi
Posts: 21
Posted 18:58 Feb 22, 2018 |

10 - Establish how many times statement x = 2* x is executed in the asymptotic sense:

   j = n; x = 1;
   while ( j >= 1 ) {
      for ( i = 1; i <= 2*n; i++ )
         x = 2 * x;
      j = j / 2;
   }

 

16 - Establish how many times statement x = 2* x is executed in the asymptotic sense:

   j = n; x = 1;
   while ( j >= 1 ) {
      for ( i = 1; i <= 2*n; i++ )
         x = 2 * x;
      j = j / 2;
   }

Last edited by marrawi at 18:59 Feb 22, 2018.