pub fn remove(list: *SinglyLinkedList, node: *const Node) void list: *SinglyLinkedListnode: *const Node90
91
92
93
94
95
96
97
98
99
100pub fn remove(list: *SinglyLinkedList, node: *const Node) void {
if (list.first == node) {
list.first = node.next;
} else {
var current_elm = list.first.?;
while (current_elm.next != node) {
current_elm = current_elm.next.?;
}
current_elm.next = node.next;
}
}
Remove
nodefrom the list. Asserts thatnodeis in the list.