算法与数据结构堆单选难度 3真题改编 · 2024
12. 将关键字9, 19, 12, 21, 28, 25, 31, 27, 43, 17, 44依次插入到初始为空的小根堆H中,得到的H是( )
练习本题 ›
算法与数据结构栈单选难度 3真题改编 · 2024
13. 下列程序的运行结果是( )
import java.util.*;
class Test{
public static void main(String[] args){
int[] pushA={1,2,4,5,3,6};
int[] popA1={4,5,2,3,1,6};
int[] popA2={4,6,5,2,3,1};
boolean res1=IsPopOrder(pushA,popA1);
boolean res2=IsPopOrder(pushA,popA2);
System.out.println(res1);
System.out.println(res2);
}
public static boolean IsPopOrder(int[] pushA,int[] popA){
if(pushA.length==0||popA.length==0) return false;
Stack<Integer> st=new Stack<Integer>();
int index=0;
for(int i=0;i<pushA.length;i++){
st.push(pushA[i]);
while(!st.empty()&&st.peek()==popA[index]){
st.pop();
index++;
}
}
return st.empty();
}
}
练习本题 ›
数据库单选难度 3真题改编 · 2024
28. 在 MySQL 5.7(或更早)环境下,有两张使用以下命令创建的数据库表:
create table T(a INT, b char);
有几条查询语句如下所示:
语句1:
select a, b from T where a = 10
union all
select a, b from T where c = "20"
语句2:
select a, b from T where a = 10
union
select a, b from T where c = "20"
语句3:
select a, b from T group by a, b
语句4:
select a, b from T group by a, b order by null;
以下说法正确的是?
练习本题 ›
算法与数据结构递归单选难度 3真题改编 · 2024
31. 现有一个待排序的数组a={6, 5, 4, 3, 2, 1, 8, 8},完成最终归并排序(升序)的前一步的结果为()。
练习本题 ›
算法与数据结构单选难度 3真题改编 · 2024
36. 已知一个有序表(2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22),当二分查找值为15的元素时,查找失败的比较次数为( )
练习本题 ›