作者aweila75 (David)
看板TransCSI
标题[问题] 95yzu-IM 问答题
时间Tue May 29 22:56:14 2007
6.
(a)Describe a procedure to remove the bottom entry from a stack so that the
rest of the stack is retained.
(b)Describe a procedure to print a linked list in reverse order using a stack.
(c)What data structure is most suitable for checking the parenthesis in
arithmetic expression? Describe the procedure briefly.
(a)直接写出stack移除最顶端的资料的虚拟码即可?
(b)完全不会;不然就是我看不懂题目要做什麽XD
(c)同上
7. The division hash function is used to construct a hash file. Assume that 20,
21,22 or 23 may be used for division. Which of the choices is best? Briefly
describe the reason.
我觉得是23?
因为23为质数,较不容易产生collision
这样回答不知道对不对呢?
8.What's the time complexity to merge two sorted lists with O(N) elements into
a sorted list?
这题直接假设他用来合并的排序法为merge sort吗?然後因为merge sort的time
complexity为 O(n log2 n),所以答案为O(n log2 n)。 这样对吗?
麻烦高手解答。感谢您。
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 218.162.127.244
1F:→ aubr3:6a 底部 6b 印出反方向的list 6c 什麽资料结构最适合数学运 05/30 11:02
2F:→ aweila75:题目懂,但不会写 06/01 17:32
3F:→ aubr3:while(stackA is not empty){ 06/02 18:55
4F:→ aubr3:stackB.push(stackA.pop()); 06/02 18:57
5F:→ aubr3:} 06/02 18:57
6F:→ aubr3:stackB.pop(); 06/02 18:58
7F:→ aubr3:while(stackB is not empty){ 06/02 18:58
8F:→ aubr3:stackA.push(stack.pop());} 06/02 18:58
9F:→ aubr3:======================================================== 06/02 18:59
10F:→ aubr3:while(queueA is not empty){ 06/02 19:01
11F:→ aubr3:stackB.push(de_queueA());} 06/02 19:02
12F:→ aubr3:while(stackB is not empty){ 06/02 19:04
13F:→ aubr3:en_queueA(stackB.pop());} 06/02 19:05
14F:→ aubr3:======================================================== 06/02 19:05
15F:→ aubr3:while(exp is not end){ 06/02 19:18
16F:→ aubr3:写到断线XD就,不想写了上面是前两题的 06/03 20:55