This algorithm is really very perfect! As a supplement, I think the following approach is an idea to solve the problem if there is no intersection between the two lists.

We assume that the length of headA is 'm' and the length of headB is 'n', follow the above ideas, we will find the node at which the intersection of two singly linked lists begins within 'm + n - 1' steps. So the corresponding C++ code is:

```
ListNode *getIntersectionNode(ListNode *headA, ListNode *headB) {
if (headA == NULL || headB == NULL)
return NULL;
if (headA == headB)
return headA;
ListNode *curA = headA;
ListNode *curB = headB;
int lenA = 0, lenB = 0;
while (curA != NULL) {
++lenA;
curA = curA->next;
}
while (curB != NULL) {
++lenB;
curB = curB->next;
}
curA = headA;
curB = headB;
for (int step = 0; step != lenA + lenB; ++step) {
curA = curA ? curA->next : headB;
curB = curB ? curB->next : headA;
if (curA == curB)
return curA;
}
return NULL;
}
```