作者IDontBite (IDontBite)
看板Grad-ProbAsk
標題[理工] [資結]-93師大資教
時間Wed Jan 27 17:18:05 2010
Suppose that we have a file in which each record has 3 component keys
(k1,k2,k3). To sort these into lexicographic order, we decide to sort
the entire file by k3, then sort the entire file by k2, and finally
sort the entire file by k1. For this to work correctly, which sorts
must be done by stable sorting algorithms?
(A) The sort by k3
(B) The sort by k2
(C) The sort by k1
(D) Both (A) and (B)
(E) Both (B) and (C)
答案給D, 但我覺得是E (C不stable那前面都在排心酸的),
大家覺得?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.32.189.59
推 FRAXIS:我也覺得是E 01/27 17:24
推 ottokang:排的順序是k3→k2→k1,k3跟k2要stable,D應該沒錯吧 01/28 17:11
→ IDontBite:排(3,0,5),(3,1,5),(3,2,5),(3,3,5),k1那次用heapsort 01/28 17:54
→ IDontBite:排出來會是(3,1,5),(3,2,5),(3,3,5),(3,0,5) 01/28 17:56