123456789101112131415161718192021222324252627282930313233343536373839404142434445
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
typedef int BOOL;
#define TRUE 1
#define FALSE 0
typedef
struct node
{
ElemType data;
struct node * next;
}
Node;
public ListNode getIntersectionNode(ListNode headA, ListNode headB) {
ListNode pL = headA;
ListNode pS = headB;
int lenA = 0;
while(pL != null){
lenA++;
pL = pL.next;
}
int lenB = 0;
while(pS != null){
lenB++;
pS = pS.next;
}
pL = headA;
pS = headB;
int len = lenA - lenB;
if(len = 0){
lenB=lenA;1
}
else{
return FALSE;
}
void *data;
while(pL->data!=pS->data){
pL->data=pL.next->data;
pS->data=pS.next->data;
printf(TRUE);
}
return FALSE;}