題目1:下面圖問號處該填什麼?(不好意思 圖咋都貼不上去 只好給個鏈接~ 誰能幫忙貼下圖)
http://album.hi.csdn.net/app_uploads/jinder22/20081201/100422452.p.jpg?d=20081201100453467
題目2:There is a kind of cord which is NOT uniform. It will cost one hour to burn such a cord from one top to another top. Now assume you can use three such cords. Then which time you can not measure precisely?(有一條不均勻的繩子,從一端燒到另一端需要1小時,假設你有3根這樣的繩子,下面哪個時間你不能精確得到)
A 15min B 22.5min C 35min D both of ABC
題目3:There are two buckets. The capacity are six kilolitre and ten kilolitre. All these two buckets are NOT uniform(均勻). Now assume you have these 2 buckets and a pool with unlimited water. And we define either of such three operations as one step(兩個不均勻的桶,一個6升另一個10升,如果池塘有無限的水,那麼下面步驟):
1> Pour water from the pool to one bucket untill this bucket is full;(用水把其中一個桶灌滿)
2> Pour water from A to bucket B until bucket A is empty or bucket B is full;(把其中一個桶的水灌入另一桶直到一個桶空一個桶滿)
3> Pour away water from one bucket to the pool untill this bucket is empty;(八其中一個桶到光)
If you could get eight kilolitre of water in the larger bucket precisely, you should execute at least ______ steps?(如果你想在10升大桶中得到8升水,那你至少要執行幾步操作)
A 6 B 8 C 10 D 12
題目4:In which system(進制) expression 13*16=244 is true?
A 5 B 7 C 9 D 11
題目5:一個魚塘,養魚若干,請想一個辦法儘量準確的估算其中有多少條魚。
題目6:int FindMiddle(int a ,int b,int c)和int CalMiddle(int a ,int b,int c)分別爲兩個C函數,他們都號稱能返回三個輸入int 中中間大小的那個int.。你無法看到他們的源代碼,你如何判斷哪個函數的質量好?
題目7:請於都下面這段C++代碼,說明Fun1和Fun2的功能,並解釋他們的優缺點。
Fun1
unsigned long CountBit(unsigned long X)
{
X = (X & 0x55555555) + (X >> 1 & 0x55555555);
X = (X & 0x33333333) + (X >> 2 & 0x33333333);
X = (X & 0x0F0F0F0F) + (X >> 4 & 0x0F0F0F0F);
X = (X & 0x00FF00FF) + (X >> 8 & 0x00FF00FF);
X = (X & 0x0000FFFF) + (X >> 16 & 0x0000FFFF);
return(X);
}
fun2
int Fun2(unsigned int x)
{
int n=0;
while (x)
{
x&=(x-1);
n++;
}
return n;
}
題目8:判斷二維平面上兩條線段是否規範相交(有且只有一個非端點的交點);輸入四個點的座標(Ax,Ay),(Bx,By),(Cx,Cy)和(Dx,Dy),分別表示第一條線段AB的兩個端點,和第二條線段CD的兩個端點。輸出1表示相交,0表示不相交。設計的算法中,不允許計算直線間的交點座標,因爲求方程的解設計到浮點除法,這將丟失很多精度,但是浮點的乘法是允許的。請闡述算法思想,並用C++代碼實現。
題目9:問1:
敘述如何用雙鏈表結構描述下面的一個稀疏矩陣?假定在該結構中,非零元的記錄從最左列遍歷到最右列,每一列從上至下遍歷。並用C++代碼實現(在該問題給出的矩陣中,記錄信息的順序是{a11,a21,a41,a22,a52……,a45,a55}。)
a11 0 a13 0 0
a21 a22 0 a24 0
0 0 a33 0 0
a41 0 0 a44 a45
0 a52 0 0 a55
問2:
請給出你所能想到的其他更好的描述稀疏矩陣的數據結構。並說明好在哪裏,比如矩陣乘法,加法,行列式運算,方程求解等方面的運算效率,存儲器空間的使用效率等等。
題目10Please give a description of the algorithm to renmove the dead code in a program (That is,”dead code elimination ”),(An instruction and a variable are dead if it computes values which are not used on any executable path to the procedure’s exit.)For example, in below program,(請給出一個算法,實現移除死代碼的功能)
b=a+c
d=c+f
d=d*a
d=d*c
return d;
Instruction “b=a+c”is dead since b has no effect to the final output d.(比如說上面的代碼中b=a+c 就對最後結果d一點用處都沒有)
We need an algorithm to find out such dead code and remove them from the final program.
如何請寫出算法,和解題思路。