function traverse(head) { let current = head; while (current !== null) { // Accessing current node visit(current.data); // Move to next pointer current = current.next; }}
function traverse(head) { let current = head; while (current !== null) { // Accessing current node visit(current.data); // Move to next pointer current = current.next; }}
Node Structure: Each element is a 'Node' containing data and a pointer (next) to the next node in the sequence.
Traversal: Unlike arrays, you cannot jump to a specific index. You must start at the Head and follow the pointers.
Linear Search: To find a value, you iterate through the list until the next pointer is null.