• 2021-04-14
    试分析下面程序段的时间复杂度。 x=90; y=100; while(y>0) if(x>100) {x=x-10;y--;} else x++;
  • O(1)

    内容

    • 0

      中国大学MOOC:下面算法的时间复杂度为()。x=100;y=100;while(y>0)if(x>100){x=x-10;y--;}elsex++;

    • 1

      【填空题】下面程序段的时间复杂度是 。 x=0; for( i =1; i <n; i ++) for(j= i +1;j<=n;j++) x++; 试 分析下面程序段的时间复杂度 。 x=9 0 ; y=100; w hile(y>0) if(x>100) {x=x-10;y--;} else x++; 试 分析下面程序段的时间复杂度 。 x=0; for(i=1; i<n; i++) for (j=1; j<=n-i; j++) x++; 试 分析下面各程序段的时间复杂度 。 i=1; while(i<=n) i=i*3;

    • 2

      下面算法的时间复杂度为( )。x=100; y=100;while(y&gt;0) if(x&gt;100) {x=x-10; y--;} else x++;? O(n)|O(1)|O(100)|O(n*n)

    • 3

      下面算法的时间复杂度为( )。x=100; y=100; while(y>0) if(x>100) {x=x-10; y--;} else x++; A: [img=37x25]1803bee42996c49.png[/img] B: [img=39x25]1803bee432aa0b5.png[/img] C: [img=46x27]1803bee43af3a50.png[/img] D: [img=55x25]1803bee444479c2.png[/img]

    • 4

      下面算法的时间复杂度为( )。x=100; y=100; while(y>0) if(x>100) {x=x-10; y--;} else x++; A: [img=37x25]180339ea5deb27e.png[/img] B: [img=39x25]180339ea6779844.png[/img] C: [img=46x27]180339ea6f7f320.png[/img] D: [img=55x25]180339ea789db6c.png[/img]