Function len [src]
Iterate over all nodes, returning the count.
This operation is O(N). Consider tracking the length separately rather than
computing it.
Prototype
pub fn len(list: SinglyLinkedList) usize
Parameters
list: SinglyLinkedList
Source
pub fn len(list: SinglyLinkedList) usize {
if (list.first) |n| {
return 1 + n.countChildren();
} else {
return 0;
}
}