1写出下列算法的时间复杂度。
(1)冒泡排序;
(2)选择排序;
(3)插入排序;
(4)快速排序;
(5)堆排序;
(6)归并排序;
2写出下列程序在X86上的运行结果。
struct mybitfields
{
unsigned short a : 4;
unsigned short b : 5;
unsigned short c : 7;
}test
void main(void)
{
int i;
test.a=2;
test.b=3;
test.c=0;
i=*((short *)&test);
printf("%d\n",i);
}
3写出下列程序的运行结果。
unsigned int i=3;
cout<<i * -1;
4写出下列程序所有可能的运行结果。
int a; 英才家园my.chinahrlab.com
int b;
int c;
void F1()
{
b=a*2;
a=b;
}
void F2()
{
c=a 1;
a=c;
}
main()
{
a=5;
//Start F1,F2 in parallel
F1(); F2();
printf("a=%d\n",a);
}
5考察了一个CharPrev()函数的作用。
6对 16 Bits colors的处理,要求:
(1)Byte转换为RGB时,保留高5、6bits;
(2)RGB转换为Byte时,第2、3位置零。
7一个链表的操作,注意代码的健壮和安全性。要求:
(1)增加一个元素;
(2)获得头元素;
(3)弹出头元素(获得值并删除)。
8一个给定的数值由左边开始升位到右边第N位,如
0010<<1 == 0100
或者
0001 0011<<4 == 0011 0000
请用C或者C 或者其他X86上能运行的程序实现。
附加题(只有在完成以上题目后,才获准回答)
In C , what does "explicit" mean? what does "protected" mean?
(1)冒泡排序;
(2)选择排序;
(3)插入排序;
(4)快速排序;
(5)堆排序;
(6)归并排序;
2写出下列程序在X86上的运行结果。
struct mybitfields
{
unsigned short a : 4;
unsigned short b : 5;
unsigned short c : 7;
}test
void main(void)
{
int i;
test.a=2;
test.b=3;
test.c=0;
i=*((short *)&test);
printf("%d\n",i);
}
3写出下列程序的运行结果。
unsigned int i=3;
cout<<i * -1;
4写出下列程序所有可能的运行结果。
int a; 英才家园my.chinahrlab.com
int b;
int c;
void F1()
{
b=a*2;
a=b;
}
void F2()
{
c=a 1;
a=c;
}
main()
{
a=5;
//Start F1,F2 in parallel
F1(); F2();
printf("a=%d\n",a);
}
5考察了一个CharPrev()函数的作用。
6对 16 Bits colors的处理,要求:
(1)Byte转换为RGB时,保留高5、6bits;
(2)RGB转换为Byte时,第2、3位置零。
7一个链表的操作,注意代码的健壮和安全性。要求:
(1)增加一个元素;
(2)获得头元素;
(3)弹出头元素(获得值并删除)。
8一个给定的数值由左边开始升位到右边第N位,如
0010<<1 == 0100
或者
0001 0011<<4 == 0011 0000
请用C或者C 或者其他X86上能运行的程序实现。
附加题(只有在完成以上题目后,才获准回答)
In C , what does "explicit" mean? what does "protected" mean?