Doubly-linked list/AutoHotkey: Difference between revisions

Content added Content deleted
(moved to the linked list collection)
m (Fixed syntax highlighting.)
 
Line 1: Line 1:
{{collection | Linked_List}}
{{collection | Linked_List}}


== Doubly-Linked List solutions ==
===Doubly-Linked List solutions===


[http://www.autohotkey.com/forum/viewtopic.php?t=44657&postdays=0&postorder=asc&start=333 discussion]
[http://www.autohotkey.com/forum/viewtopic.php?t=44657&postdays=0&postorder=asc&start=333 discussion]
<lang AutoHotkey>Build(D, L) { ; Double Linked list "D": D_{Head,Tail} = number>0 id of node
<syntaxhighlight lang="autoHotkey">Build(D, L) { ; Double Linked list "D": D_{Head,Tail} = number>0 id of node
Local i ; D_%number%_{P,N,V}: Prev, Next, Value, D_%Free%: next free idx
Local i ; D_%number%_{P,N,V}: Prev, Next, Value, D_%Free%: next free idx
Loop Parse, L, `,
Loop Parse, L, `,
Line 94: Line 94:
Build("D", L)
Build("D", L)
MsgBox % "traverse forward: `n" Traverse("D","FW")
MsgBox % "traverse forward: `n" Traverse("D","FW")
MsgBox % "traverse backward: `n" Traverse("D","Back")</lang>
MsgBox % "traverse backward: `n" Traverse("D","Back")</syntaxhighlight>