Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

1
  • 1
    $\begingroup$ A way of breaking this idea done is to write a swap(t,i,j) function that swaps elements in t[i] and t[j] updating pointers accordingly to preserve the original linked list (which can be done since it is doubly linked)? Then just follow the list and when reading the ith element, get its index j (which can be done with some pointer arithmetic I guess) and call swap(t,i,j). $\endgroup$
    – holf
    Commented Jul 3 at 9:29