PLEASE KINDLY CHECK WHY THE HELL THIS CODE IS NOT GETTING SUBMITTED ALTHOUGH ITS GETTING COMPILED AND SHOWING THE CORRECT OUTPUT…KINDLY TELL AS SOON AS POSSIBLE
Merge sort code not getting submitted
#include using namespace std; class node { public: int data; nodenext; node(int d) { data=d; next=NULL; } }; int length(nodehead) { int len=0; while(head!=NULL) { len+=1; head=head->next; } return len; } void insertionAtTail(node*&head,int data) { if(head==NULL) { head=new node(data); } else { nodetail=head; while(tail->next!=NULL) { tail=tail->next; } tail->next=new node(data); } } void print(node&head) { while(head!=NULL) { cout<data<<" "; head=head->next; } cout<<endl; } void buildlist(node*&head,int n) { int data; while(n!=0) { cin>>data; insertionAtTail(head,data); n–; } } nodemerge(nodea,nodeb) { nodec; if(a==NULL) { return b; } else if(b==NULL) { return a; } else if(a->datadata) { c=a; c->next=merge(a->next,b); } else { c=b; c->next=merge(a,b->next); } return c; } int main() { int t,n1,n2; cin>>t; if(t>=1 && t<=1000) { for(int i=1;i<=t;i++) { nodehead1=NULL; nodehead2=NULL; cin>>n1; if(n1>=0 && n1<=1000000) { buildlist(head1,n1); } cin>>n2; if(n2>=0 && n2<=1000000) { buildlist(head2,n2); } node*m=merge(head1,head2); print(m); } } return 0; }