Doubly-linked list/Definition: Difference between revisions
Content added Content deleted
Line 1,141: | Line 1,141: | ||
{{out}} |
|||
<pre>$ patscc -O2 -DATS_MEMALLOC_GCBDW dllist-demo.dats dllist.dats dllist.sats -lgc && ./a.out |
|||
doubly linked list: 10 20 30 40 50 |
|||
conversion to a regular list: 10, 20, 30, 40, 50 |
|||
traversal backwards: 50 40 30 20 10 |
|||
traversal forwards, given a non-root node: 10 20 30 40 50 |
|||
traversal backwards, given a non-root node: 50 40 30 20 10 |
|||
insertion after the root: 5 10 20 30 40 50 |
|||
insertion before the root: 5 10 20 30 40 50 55 |
|||
insertion after the second element: 5 10 15 20 30 40 50 55 |
|||
insertion before the second from last element: 5 10 15 20 30 40 45 50 55 |
|||
removal of the element 30: 5 10 15 20 40 45 50 55</pre> |
|||
''Aside: This is a form of doubly linked list I first implemented in Fortran 2008 for a mark-and-sweep garbage collector. I used the list to store the mutator roots.'' |
|||
=={{header|AutoHotkey}}== |
=={{header|AutoHotkey}}== |