Timeline for In-Place Reordering of Doubly Linked List Nodes to Ensure Memory Contiguity
Current License: CC BY-SA 4.0
3 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 4 at 5:07 | history | edited | gnasher729 | CC BY-SA 4.0 |
added 75 characters in body
|
Jul 3 at 9:29 | comment | added | holf |
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) .
|
|
Jul 3 at 7:07 | history | answered | gnasher729 | CC BY-SA 4.0 |