算法与数据结构队列单选难度 3真题改编 · 2024
463. 假设操作系统中有5个作业,它们的到达时刻分别是0,3,5,7,9,运行时间分别是4,2,3,1,5,系统在t=2时开始作业调度,如果采用时间片轮转调度算法,每个时间片为3个时间单位,那么在t=2时,选中的作业是()。
练习本题 ›
编程语言单选难度 3真题改编 · 2024
468. 实现一个函数,将两个有序整数数组合并为一个有序数组,并返回新的数组 public class MergeArrays {
public static int[] merge(int[] arr1, int[] arr2) {
int[] result = new int[arr1.length + arr2.length];
int i = 0, j = 0, k = 0;
while (i < arr1.length && j < arr2.length) {
if (____) { // 填空
result[k++] = arr1[i++];
} else {
result[k++] = arr2[j++];
}
}
while (i < arr1.length) {
result[k++] = arr1[i++];
}
while (j < arr2.length) {
result[k++] = arr2[j++];
}
return result;
}
public static void main(String[] args) {
int[] arr1 = {1, 3, 5};
int[] arr2 = {2, 4, 6};
int[] merged = merge(arr1, arr2);
System.out.println(Arrays.toString(merged));
}
}
填空内容是:
练习本题 ›
操作系统单选难度 3真题改编 · 2024
479. 某社交媒体平台的存储系统在T1时刻进程已访问的页号序列为3, 2, 4, 1, 5, 1, 4, 2, 1, 5,6, 7, 4, 3,采用先进先出(FIFO)算法,当访问的页号为7时,页框可能为多少时页号4淘汰?
练习本题 ›