試卷名稱:104年 - 104 國立交通大學_碩士班考試入學試題_資訊聯招:資料結構與演算法#113199
年份:104年
科目:研究所、轉學考(插大)◆資料結構與演算法
10. For a doubly-linked list class, each of its nodes has two links left and right to its two neighboring
nodes. Assume that we want to implement a member function ShiftRight, which takes an input x, a
pointer to a node, and swaps that node with the node to its right. Let us further assume that neither xx nor
the node to its right is the first or the last node of the list. There are six pointers to be set, and the
statements, labeled s1 to s6, are listed in the box below. Which of the following ordering of these
statements will produce the correct behavior?
(A)s5→s2→s6→s1→s4→s3
(B)s2→s5→s4→s3→s1→s6
(C)s4→s3→s6→s1→s2→s5
(D)s1→s2→s3→s6→s5→s4
(E)s4→s5→s3→s6→s1→s2