1: void find_common_nodes_position(list_t *list1,list_t *list2)
2: {
3: int pos1=0,pos2=0;
4: list_t *temp1 = NULL;
5: list_t *temp2 = NULL;
6: for(pos1=1,temp1=list1;temp1;temp1=temp1->next,pos1++)
7: {
8: for(pos2=1,temp2 = list2;temp2;temp2 = temp2->next,pos2++)
9: {
10: if ( temp1->data == temp2->data)
11: {
12: printf("Data %d common at %d in list1 and %d at list2\n",
13: temp1->data,pos1,pos2);
14: }
15: }
16: }
17: return;
18: }
RTOS, Linux Kernel internal, OS-Programming C & Data Structures, Debugging, Optimizations, Makefiles and Wireless Technologies (Wi-Fi ,LTE and LTE-Advanced )
Search This Blog
Sunday, September 21, 2014
WAP to find common data position in two different given Singly Linked lists.
Labels:
C,
Data Structure
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment