Jump to content

Singly-linked list/Reversal: Difference between revisions

m
imported>StraightDoubt
(Added Common Lisp with various examples)
m (→‎{{header|Wren}}: Minor tidy)
Line 613:
 
However, it's also possible to reverse the LinkedList in place by successively exchanging elements at both ends. Internally, the 'exchange' method uses the indexer to swap elements.
<syntaxhighlight lang="ecmascriptwren">import "./llist" for LinkedList
import "./iterate" for Reversed
 
Line 630:
// iterate backwards by creating a list internally
for (e in Reversed.new(sll)) System.write("%(e) ")
System.print("\n")
 
// reverse the linked list in place
9,482

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.