7 lines
282 B
Text
7 lines
282 B
Text
ds = CreateDataStructure["DoublyLinkedList"];
|
|
ds["Append", #] & /@ {1, 5, 7, 0, 3, 2};
|
|
ds["Prepend", 9];
|
|
ds["Append", 4];
|
|
(* This is adding at the end and then swap to insert in to the middle: *)
|
|
ds["Append", 14]; ds["SwapPart", Round[ds["Length"]/2], ds["Length"]];
|
|
ds["Elements"]
|