#include <fstream.h> #include <iostream.h> int main () { ifstream f1, f2; ofstream f3; int i,j; f1.open("n1"); f2.open("n2"); f3.open("n1n2"); f1 >> i; f2 >> j; while (f1 && f2) { if (i < j) { while (i < j && f1 && f3) { f3 << i << endl; f1 >> i; } } else { while (j <= i && f2 && f3) { f3 << j << endl; f2 >> j; } } } while (f1) { f3 << i << endl; f1 >> i; } while (f2) { f3 << j << endl; f2 >> j; } return (0); }
All Computer Programming languages and its basics (C,C++,JAVA,PHP,SAP(ALL MODULES)
Tuesday, 15 April 2014
Merge Sort In C
Labels:
Merge Sort in C
Subscribe to:
Post Comments (Atom)
Comment
Comment Box is loading comments...
No comments:
Post a Comment