Doubly Linked List merging operation, merge function/algorithm

Merging:- Merging is a process of combining the nodes of two or more Doubly Linked List into a new Doubly Linked List of same type. The number of nodes of resultant Doubly Linked List is the sum of nodes of all combined Doubly Linked List.
मर्जिंग:- मर्जिंग वह प्रक्रिया है जिसमे एक ही प्रकार के दो या दो से अधिक डबली लिंक्ड लिस्ट को आपस में जोड़कर एक परिणामी डबली लिंक्ड लिस्ट तैयार किया जता है। परिणामी डबली लिंक्ड लिस्ट में नोड्स की संख्या, जोड़े गए सभी डबली लिंक्ड लिस्ट के नोड्स की संख्या के योग के बराबर होती है। 
In following function/algorithm we combine two DLL-
निम्न फंक्शन या अल्गोरिथम में दो DLL को आपस में जोड़ा गया है- 
//Merging nodes of two DLL

void mergedll(NODE *first1,NODE *last1,NODE *first2,NODE *last2){
clrscr();
if(first1==NULL || first2==NULL){
printf("Either one or both DLL are not Exist\nMerging Operation Failed!!\n");
getch();
return;
}
last1->next=first2;
first2->back=last1;
last1=last2;
first2=last2=NULL;
printf("Merging operation performed Successfully in DLL\n");
getch();
return;
}

No comments:

Post a Comment

Stack Data Structure, Push, Pop and Peek Operations , Applications of Stack

Stack is a linear data structure. It is collection of ordered data elements. It is also known as LIFO system (last in first out). It means i...