Singly-linked list/Element insertion: Difference between revisions
Singly-linked list/Element insertion (view source)
Revision as of 18:48, 19 June 2023
, 11 months ago→{{header|jq}}: def insert($x):
(Added Odin variant) |
(→{{header|jq}}: def insert($x):) |
||
Line 1,447:
def insert($x):
if is_empty_singly_linked_list then {item: $x, next: null}
.next |= new($x; .);</syntaxhighlight>▼
else .next |= new($x; .)
'''An example''':
<syntaxhighlight lang="jq">
|