int length(Node *head) { Node *curr = head; int count = 0; while (curr != NULL) { count++; curr = curr->next; } return count; }