精華區beta TransCSI 關於我們 聯絡資訊
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
aubr3:6a 底部 6b 印出反方向的list 6c 什麼資料結構最適合數學運 05/30 11:02
aweila75:題目懂,但不會寫 06/01 17:32
aubr3:while(stackA is not empty){ 06/02 18:55
aubr3:stackB.push(stackA.pop()); 06/02 18:57
aubr3:} 06/02 18:57
aubr3:stackB.pop(); 06/02 18:58
aubr3:while(stackB is not empty){ 06/02 18:58
aubr3:stackA.push(stack.pop());} 06/02 18:58
aubr3:======================================================== 06/02 18:59
aubr3:while(queueA is not empty){ 06/02 19:01
aubr3:stackB.push(de_queueA());} 06/02 19:02
aubr3:while(stackB is not empty){ 06/02 19:04
aubr3:en_queueA(stackB.pop());} 06/02 19:05
aubr3:======================================================== 06/02 19:05
aubr3:while(exp is not end){ 06/02 19:18
aubr3:寫到斷線XD就,不想寫了上面是前兩題的 06/03 20:55