DoxigAlpha

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

#
popFirst
Remove and return the first node in the list.
len
Iterate over all nodes, returning the count.

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;
    }
}