中国大学MOOC: 阅读下面的程序,其时间复杂度为_________?intindex=5;intcondition=1;if(condition==1)thenindex++;elseindex--;fori=1to100forj=1to200index=index+2;
举一反三
- 阅读下面的程序,其时间复杂度为_________?1. int index =...009. index=index+2;
- 写出下面程序的输出结果 publicclassTestjava{ publicstaticvoidmain(String[]args){ Stringstr="abbaefabbewbvwabbswgfga"; System.out.println("count="+getSubCount(str,"abb")); } publicstaticintgetSubCount(Stringstr,Stringkey){ intcount=0; intindex=0; while((index=str.indexOf(key,index))!=-1){ System.out.println("index="+index); index=index+key.length(); count++; } returncount; } }
- 中国大学MOOC: 下面程序的时间复杂度为() x=1for i=1 to n dofor j=1 to i do for k=1 to j do x++
- 当输入为 ‘cbabc’ 时,下列程序的输出结果为?s1 = raw_input() index = 0 s2 = '' while index [ len(s1) - 1: if s1[index] ] s1[index + 1]: s2 += s1[index] else: s2 = s2 * 2 index += 1 print s2
- 阅读下面的程序:li_one = [2, 1, 5, 6]print(li_one[:2]) A: [2, 1] B: [1, 5, 6] C: [1, 2, 5, 6] D: [6, 5, 2, 1]