作者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
1F:推 FRAXIS:我也觉得是E 01/27 17:24
2F:推 ottokang:排的顺序是k3→k2→k1,k3跟k2要stable,D应该没错吧 01/28 17:11
3F:→ IDontBite:排(3,0,5),(3,1,5),(3,2,5),(3,3,5),k1那次用heapsort 01/28 17:54
4F:→ IDontBite:排出来会是(3,1,5),(3,2,5),(3,3,5),(3,0,5) 01/28 17:56