Anyone can tell me logic for two unsorted linked list. I have create two linked list named First and second . Now how to generate intersection linked list named third?
Take an element from first, then search for it in second. If it's there, add it to third. That'll be two for loops. Although you could use std::find, you probably shouldn't.
i have modify that program now program work properly but one problem is there last element can take if it is same in both list i know reason but what to do i don't know...reason is that when current pointer( of any list whether it is of first or second )reach at last node at that time while condition become true and last node data can 't compare so it will be not added in to third list. The code for that is
still it does not give intersection in all the possible input....
and is there any difference between current->next!=NULL and current!=NULL
I think both are same...Is it right?
k i got may mistake . inside second while loop, the variable is temp->data=first_current->data instead temp->data=first->data same changes in else part of IF condition...
But can you tell me difference between current!=NULL and current->next!=NULL?