【单选题】【消耗次数:1】
设语句x++的时间是单位时间,则以下语句的时间复杂度为( )。 for(i=1; i<=n; i++) for(j=i; j<=n; j++) x++;
O(1)
O(n的平方)
O(n)
O(n的立方)
参考答案:
复制
纠错
相关题目
【单选题】 在下面循环语句中内层循环体S语句的执行次数为( )。 for(int i=0;i<n;i++) for(int j=i;j<n;j++)S;
①  n2
②  (n+1)/2
③  n(n-1)/2
④  n(n+1)/2
【单选题】 在下面循环语句中内层循环体S语句的执行总次数为()。 for(int i=0; i<n; i++) for(int j=i; j<n; j++) S;
①  n2
②  (n+1)/2
③  n(n-1)/2
④  n(n+1)/2
【单选题】 在下面循环语句中内层循环体S语句的执行总次数为( ) for(int i=0; i<n; i++) for(int j=i; j<n; j++) S;
①  n2
②  (n+1)/2
③  n(n-1)/2
④  n(n+1)/2
【判断题】 希尔排序算法的时间复杂度为O(n2)。()
①  正确
②  错误
【单选题】 在n个结点的顺序表中,算法的时间复杂度是O(1)的操作是
①  访问第i个结点(1≤i≤n)
②  在第i个结点后插入一个新结点(1≤i≤n)
③  删除第i个结点(1≤i≤n)
④  将n个结点从小到大排序
【单选题】 在下面循环语句中内层循环体S语句的执行总次数为( ) for(int i=0; i i++) for(int j=i; j j++) S;
①  n2
②  (n+1)/2
③  n(n-1)/2
④  n(n+1)/2
【单选题】 在下面循环语句中内层循环体S语句的执行总次数为()。 for(int i=0; i i++) for(int j=i; j j++) S;
①  n2
②  (n+1)/2
③  n(n-1)/2
④  n(n+1)/2
【判断题】 设m,n?N,(m,n)=1,则j(mn) = j(m)j(n).
①  正确
②  错误
【单选题】 下列各种排序算法中平均时间复杂度为O(n2)是()。
①  快速排序
②  堆排序
③  归并排序
④  冒泡排序
【单选题】 设j和k都是int类型,则for循环语句 for(j=0,k=-1;k=1;j++,k++)printf(****\n);().
①  循环结束的条件不合法
②  是无限循环
③  循环体一次也不执行
④  循环体只执行一次
随机题目
【单选题】 14. Through the window we can see nothing but ____ buildings.
①  tall very many
②  very many tall
③  very tall many
④  many very tall
【简答题】 Thousands of years ago in Egypt (埃及), Kings built the pyramids (金字塔). They used to build them as their tombs (坟墓). The kings thought the pyramids would help them find life [填空1]death. They also wanted the world remember them as important people. Some pyramids were for queens, but they are [填空2]interesting because they are not so big. The[填空3]pyramid that we know today is the pyramid that we know today is the pyramid near Sahara ( 撒哈拉沙漠) in Egypt. It is about 5,000 years old. There are many pyramids along the Nile River (尼罗河). The largest is the pyramid of Khufu (法老胡夫). It is made of two million three hundred thousand huge stones, most of [填空4]higher than a person. It is about 144 meters high. Inside the pyramid[填空5]the burial rooms (墓室)for the king and queen and long passage (通道) ways [填空6]these rooms. The rest of the pyramid is solid (坚固的) stone. We know there were wonderful[填空7]in the pyramid. Robbers[填空8]into the pyramids and took many of these treasures (财宝). Today some of the treasures are in museums [填空9]. How did the people of ancient [填空10]build the pyramids?How did they carry and lift the huge stones? Each stone [填空11]so well and they didn’t have our[填空12]machines. Scientists[填空13]the pyramids but nobody can say just how they [填空14]. Some day if you can, you ought to go to see the pyramids. I[填空15]you that they would be amazing.1. A. beforeB. afterC. behindD. in front of2. A. moreB. lessC. noD. very3. A. eldestB. youngestC. oldestD. smallest4. A. themB. whomC. whichD. that5. A. there areB. there isC. areD. is6. A. toB. withC. forD. in7. A. treasureB. treasuresC. moneyD. gold8. A. cameB. wentC. brokeD. walked9. A. thoughB. howeverC. everD. since10. A. dayB. momentC. momentsD. days11. A. wearsB. fitsC. liftsD. carries12. A. freshB. electronicC. modernD. scientific13. A. have studiedB. will studyC. studiedD. were studying14. A. have done thatB. did soC. did itD. are doing it15. A. sureB. assureC. insureD. ensure
【单选题】 5.I will visit you if Father me.
①  let
②  lets
③  is letting
④  will let
【单选题】 9.“Has he seen this film?” “Yes. He _______ it several days ago.”
①  saw
②  has seen
③  had seen
④  was seeing
【单选题】 3.A hunter is a man who animals.
①  catch
②  catches
③  will catch
④  was catching
【单选题】 2.She the door before she goes away.
①  had locked
②  is locking
③  has locked
④  was locking
【单选题】 4.What if I drink this?
①  happens
②  is happening
③  will happen
④  is happened
【单选题】 10.Now Mike isn’t here. He _________ Mr. Green’s. Perhaps he _______ back in a few minutes.
①  went to; is coming
②  has gone to; will come
③  has been to ; will be
④  is going to; has come
【单选题】 6.Look out! That tree _______ fall down.
①  is going to
②  will be
③  shall
④  would
【单选题】 8.They can’t leave until they ______ their work.
①  did
②  are doing
③  have done
④  has done