1:procedure SwapObject(i,j)
2:Swap(next[prev[i]],next[prev[j]])
3:Swap(prev[next[i]],prev[next[j]])
4:Swap(prev[i],prev[j])
5:Swap(next[i],next[j])
6:Swap(key[i],key[j])
7:end procedure
8:
9:x=L.head
10:i=1
11:while x=NIL do
12:SwapObject(i,x)
13:if F.head=i then
14:F.head=x
15:end if
16:x=next[i]
17:i=i+1
18:end while
19:L.head=1