## 几道面试题求解

8. A Double Tower of Hanoi contains twice the number of disk as the regular Tower of Hanoi

problem, where each disk size appears twice. So there are 2n disks, of n different sizes (n>0). As

usual, there are 3 pegs. The objective is to transfer the whole tower form the original peg to one of

the *两种颜色的psar指示器免费下载* other two pegs, moving only one disk at a time, without putting a larger one over a smaller one.

Putting a same-sized disk 两种颜色的psar指示器免费下载 onto another is okay. If we are required to reproduce the original

top-to-bottom order arrangement, how many moves (minimal) does it take? Remember, disks of

equal size need to be in original order, and cannot be inversed.

E. 2*+1 (1)3n.

10. Which of following entities CANNOT be shared by multiple threads of a process?

B. Thread-local variables

E. None of the above

13. Which of following numbers(in base 3) is 两种颜色的psar指示器免费下载 两种颜色的psar指示器免费下载 closest to decimal number 0.8889? //没看懂啥意思？

D. 0.22

E. None of 两种颜色的psar指示器免费下载 the above

17. In C, someone writes the following function to reverse a one-dimensional array. For example,

when the input is , then the result should be .

int reverse_array(int *list, int len)

Which of the following statements is correct when you compile and run this program?

A. Compilation error appears

B. Program runs correctly

C. Program runs correctly **两种颜色的psar指示器免费下载** when length of input array is odd.

D. Program runs correctly when length of input array is even.

E. None of the above

18. Assume you have two singly linked lists, denoted as L1 and L2. It is possible that L1 and L2

meet on some node and **两种颜色的psar指示器免费下载** have a common tail. If L1 has m nodes and L2 has n nodes, then what is

the best time complexity to check if the two linked lists meet and to find out the meeting point?

(Only O(1) constant amont of extra storage space is allowed.)

19. There are n green buckets and n red buckets. Each green bucket is of a different size, but for

every green bucket, there is a corresponding red bucket of the dame size. What is the AVERAGE

time complexity to find all matching buckets pairs(red and green bucket of the same size) if the

comparisons between buckets of same color are forbiden. (Only O(1) constant amount of extra

storage space is allowed.)

## 两种颜色的psar指示器免费下载

8. A Double Tower of Hanoi contains twice the number of disk as the regular Tower of Hanoi

problem, where each disk size appears twice. So there are 2n disks, of n different sizes (n>0). As

usual, there are 3 pegs. The 两种颜色的psar指示器免费下载 objective is to transfer the whole tower form the original peg to one of

the other two pegs, moving only one disk at 两种颜色的psar指示器免费下载 a time, without putting a larger one over a smaller one.

Putting a same-sized disk onto another is okay. If we are required to reproduce the original

top-to-bottom order arrangement, how many moves (minimal) does 两种颜色的psar指示器免费下载 it take? Remember, disks of

equal size need to be in original 两种颜色的psar指示器免费下载 order, and cannot be inversed.

E. 2*+1 (1)3n.

10. Which of following entities CANNOT be shared by multiple threads of a process?

B. Thread-local variables

E. None of the above

13. Which of following numbers(in base 3) is closest to decimal number 0.8889? //没看懂啥意思？

D. 0.22

E. None of the above

17. In C, someone writes the following function to reverse a one-dimensional array. For example,

when the input is , then the result should be .

int reverse_array(int *list, int len)

Which of the following statements is correct when you compile and *两种颜色的psar指示器免费下载* 两种颜色的psar指示器免费下载 两种颜色的psar指示器免费下载 run this program?

A. Compilation error appears

B. Program runs correctly

C. Program runs correctly when length of input array is odd.

D. Program runs correctly when length of input array is even.

E. None of the above

18. Assume you have two singly linked lists, denoted as L1 and L2. It is possible that L1 and L2

meet on 两种颜色的psar指示器免费下载 some node and have a common tail. If L1 has m nodes and L2 has n nodes, then what is

the best time 两种颜色的psar指示器免费下载 complexity to check if the two linked lists meet and to find out the meeting point?

(Only O(1) constant amont of extra storage space is allowed.)

19. There are n green buckets and n red buckets. Each green bucket is of a different size, but for

every green bucket, there is a corresponding red bucket of the dame size. What is the AVERAGE

time complexity to find all 两种颜色的psar指示器免费下载 matching buckets pairs(red and green bucket of the same size) if the

comparisons between buckets of same color are forbiden. (Only O(1) constant amount of extra

storage space is allowed.)

## 两种颜色的psar指示器免费下载

8. A Double Tower of Hanoi contains twice the number of disk as the regular **两种颜色的psar指示器免费下载** Tower of Hanoi

problem, where each disk size appears twice. So there are 2n disks, of n different sizes (n>0). As

usual, there are 3 pegs. The objective is to transfer the whole tower form the original peg to one of

the other two pegs, moving only one disk at a time, without putting a larger one over a smaller one.

Putting a same-sized disk onto another is okay. If we are required to reproduce the original

top-to-bottom order arrangement, how many moves (minimal) does it take? Remember, disks of

equal size need to be in original order, and cannot be inversed.

E. 2*+1 (1)3n.

10. Which of following entities CANNOT be shared by multiple threads of a process?

B. Thread-local variables

E. None of the above

13. Which 两种颜色的psar指示器免费下载 of following numbers(in base 3) is closest to decimal number 0.8889? //没看懂啥意思？

D. 0.22

E. None of the above

17. In C, 两种颜色的psar指示器免费下载 someone writes the following function to reverse a one-dimensional array. For example,

when the input is , then the result should be .

int reverse_array(int *list, int len)

Which of the following statements is correct when 两种颜色的psar指示器免费下载 you compile and run this program?

A. Compilation error appears

B. Program runs correctly

C. Program runs correctly when length of input array is odd.

D. Program runs correctly when length of input array is even.

E. None of the above

18. Assume you have two singly linked lists, denoted as L1 and L2. It is possible that L1 两种颜色的psar指示器免费下载 and L2

meet on some node and have a common tail. If L1 has m nodes and L2 has n nodes, then what is

the best time complexity to check if the two linked lists meet and to find out the meeting point?

(Only O(1) constant amont of extra storage space is allowed.)

19. There are n green buckets and n red buckets. Each green bucket is of 两种颜色的psar指示器免费下载 a different size, but for

every green bucket, there is a corresponding red bucket of the dame size. What is the AVERAGE

time complexity to find all matching buckets pairs(red and green bucket of the same size) if the

comparisons between buckets of same color are forbiden. (Only O(1) constant amount of extra

storage space is allowed.)