remove
Function parameters
Parameters
- list:*SinglyLinkedList
- node:*Node
This struct contains only a next pointer and not any data payload.
Types
- Node
- This struct contains only a next pointer and not any data payload.
Functions in this namespace
Functions
Source
Implementation
pub fn remove(list: *SinglyLinkedList, node: *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;
}
}