麵試題,特別是最後一道 Calc 是幹什麽的?


1.
You are given a suit of playing cards, 13 cards—Ace through King. For the purpose of this game, consider the Ace as being worth 1, Jack 11, Queen 12 and King 13.
You are to divide the 13 cards into 2 face-down piles: a pile of 6 and a pile of 7.
Each pile is then shuffled thoroughly.
The top card from each pile is flipped and their product is calculated.
This process is then repeated 5 more times, until only one card from the pile of 7 remains face down.
The 6 products are summed up.
How do you divide the deck to maximize the expected sum of the products?

2.
There is a lie detector which can detect lies with 90% accuracy. (If a person lies, the machine will beep 90% of the time, and if a person tells the truth it will stay silent 90% of the time.) Suppose that 85% of people tell the truth.
If a person answers a question and the machine beeps, what is the probability that they are telling the truth?

3.
How many distinct ways are there to rearrange the letters in the word ‘REARRANGE’?
What if the N and the G always had to be adjacent?
4.
Let x1, x 2, x 3… x 8 be a permutation of the integers 1, 2, 3, …, 8. For each permutation, form the sum
| x 1 – x 2| + | x 3 – x 4| + | x 5 – x 6| + | x 7 – x 8|
Find the average value of all such sums.
5.
You are receiving data over a network. Packets are supposed to arrive once per millisecond. Occasionally, there is a pause of about 200 milliseconds between arrivals. What might be causing that latency? (Do not spend more than two minutes on this question.)
6.
Describe a parallel (multi-threaded) implementation of QuickSort that runs on a computer with n processors.
7.
You are debugging on an Intel x86 processor. You are looking at the following line of 16 bytes of memory dump. The values are displayed in hexadecimal notation.
0x004b56a0 56 4f 50 55 00 00 00 00 00 00 00 00 00 00 00 00 00
What data type do you think is at address 0x004b56a0?
What would the above line of memory look like if the integer 65538 was written to memory location 0x004b56a8?
9FFEA
8.
What is the purpose of each of the following C# functions?

static public double Calc(long n)
{
long z = 0;
for (long x = -n; x for (long y = -n; y if (x * x + y * y z++;
return ((double)z) / (n * n)
}

static public double Calc(int n)
{
double x = 1;
double y = 1;
for (int j = 1; j {
y = y * n / j;
x += y;
}
return x;
}

所有跟帖: 

pi -精靈寶鑽- 給 精靈寶鑽 發送悄悄話 精靈寶鑽 的博客首頁 (0 bytes) () 02/18/2009 postreply 00:20:03

pi是倒數第二,e expotetial function最後一道。 -撿錢- 給 撿錢 發送悄悄話 (18 bytes) () 02/18/2009 postreply 05:35:03

第一題和第二題都是和概率論有關的,我試試講講第一題的思路,不敢說會解題 -IIIX- 給 IIIX 發送悄悄話 IIIX 的博客首頁 (274 bytes) () 02/18/2009 postreply 08:06:34

最後留下的是不是ace要聽天由命,但是大牌分攤在兩邊,可能得到的 -IIIX- 給 IIIX 發送悄悄話 IIIX 的博客首頁 (50 bytes) () 02/18/2009 postreply 08:14:01

是的, 別的題請TRY TRY. -撿錢- 給 撿錢 發送悄悄話 (0 bytes) () 02/18/2009 postreply 17:01:42

IT方麵的我愛莫能助,我不是學這個的。第三題很簡單了。第二題也不是太難,但是這個題 -IIIX- 給 IIIX 發送悄悄話 IIIX 的博客首頁 (374 bytes) () 02/19/2009 postreply 22:36:44

回複:第一題和第二題都是和概率論有關的,我試試講講第一題的思路,不敢說會解題 -餅幹也需要愛啊- 給 餅幹也需要愛啊 發送悄悄話 (62 bytes) () 02/18/2009 postreply 20:18:14

嗯,這個是的。所以我隻是說說思路,集體恐怕要排個式子比較一下。 -IIIX- 給 IIIX 發送悄悄話 IIIX 的博客首頁 (0 bytes) () 02/19/2009 postreply 07:07:14

可能要把大牌均勻分攤與一邊大牌多一邊大牌少的所有組合情況的期望值都列出來比較一下了 -IIIX- 給 IIIX 發送悄悄話 IIIX 的博客首頁 (0 bytes) () 02/19/2009 postreply 07:43:40

回複:回複:第一題和第二題都是和概率論有關的,我試試講講第一題的思路,不敢說會解題 -餅幹也需要愛啊- 給 餅幹也需要愛啊 發送悄悄話 (162 bytes) () 02/19/2009 postreply 21:37:40

嗯,這個非常有可能是正解。不過,嗬嗬,科學麽,光看不行。真的要 -IIIX- 給 IIIX 發送悄悄話 IIIX 的博客首頁 (231 bytes) () 02/19/2009 postreply 22:28:39

請您先登陸,再發跟帖!