問題詳情

10. For a doubly-linked list class, each of its nodes has two links left and right to its two neighboringnodes. Assume that we want to implement a member function ShiftRight, which takes an input x, apointer to a node, and swaps that node with the node to its right. Let us further assume that neither xx northe node to its right is the first or the last node of the list. There are six pointers to be set, and thestatements, labeled s1 to s6, are listed in the box below. Which of the following ordering of thesestatements 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

參考答案

答案:[無官方正解]
難度:計算中-1
書單:沒有書單,新增