作者cksh8008 (ck)
看板Grad-ProbAsk
標題[理工] Quick sort
時間Sat Oct 26 14:08:47 2013
1.Multiple choice and short answer questions
(1)supose we are sorting an array of eight integers using quicksort,and we
just finished the first partitioning with the array looking like this:
2,5,1,7,9,12,11,10
which statment is correct.
(A)the pivot could be either the 7 or the 9
(B)the pivot could be the 7,but it is not the 9
(C)the pivot is not the 7,but it could be the 9
(D)Neither the 7 nor the 9 is the pivot.
洪逸給A
但自己走一遍,感覺是D.
Pass 0 :
2,5,1,7,9,12,11,10 Pivot = 2
pass 1 :
1,[2],5,7,9,12,11,10 Pivot = 1 or 5
因為只做一次,所以應該是D吧?
還是我對quicksort或題目的意思理解錯誤
請前輩、高手指教了,拜託了謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 163.20.242.232
→ A4P8T6X9:題目給的已經做完一次了。 10/26 14:14
→ cksh8008:阿..感謝,是我粗心了 10/26 14:50