الاثنين، 11 يناير 2016

The cost of the algorithm

int sum , n, m ;

sum = 0 ;

while ( n > 1 ) {

m  =  n ;
while  ( m  >  1  ) {
    m =  m - 4 ;
    sum = sum + 0 ;
}
n = n - 4 ; }

1- Calculate The time complexity in the worst case, for this algorithm for number of (addition) operations?

2- Calculate the value of variable "sum"?



from حسوب I/O - الأكثر شيوعاً http://ift.tt/1P3JxB4

ليست هناك تعليقات:

إرسال تعليق

دائماً، رأيكم يهمنا،