填空题

在长度为n的有序线性表中进行二分查找。最坏的情况下,需要的比较次数为______。

【参考答案】

log2n
<上一题 目录 下一题>
热门 试题

填空题
以下程序的执行结果是______。 #include<iostream.h> class Sample int n; public: Sample() Sample (int i (n=i;) void add (Sample &s1,Sample s2) this->n=sl.n+=s2.n; void disp() cout<< n= << n <<end1: void main () Sample sl(2), s2(5),s3: s3.add(s1,s2); s1.disp() s2.disp(): s3.disp();
填空题
以下程序的执行结果是______。 #include<iostream.h> class Sample int n; public: Sample() Sample(int m)n+m;) int&operator--(int) n-- return n; void disp () cout<< n= <<n<<end1; void main () Sample s (10); (s--) ++; s.disp();
相关试题
  • 实现比较两个字符串大小的函数是_____。
  • 耦会和内聚是评价模块独立性的两个主要标准...
  • 空字符串的长度是_____。
  • 已知double var;是文件F1.CPP中的一个...
  • 假定一个一维数组的定义为 char a[8]...