Why it is not working?
I am implementing some functions in Linked Lists, Please help for this one.
Why it is not working?
I am implementing some functions in Linked Lists, Please help for this one.
Hey @cbcao263 it’s a plain code, showing nothing but basic c++ template, I think you forgot to add your code here & also forgot to saved it. Please provide your code.
If you feel it wrong, can you please solve it.
Hey @cbcao263 you have tagged wrong topic for wrong question. I can help you but you have to tag linked list by creating a new problem as this problem has been tagged by c++ function which is not used. I would request you to create a new doubt and add all those attachments over there so that I can help you with that
Done bro.
Please check it
Hey @cbcao263 I guess your doubt has been assigned to some other TA , but no worries he will solve it for sure. Moreover your code runs perfectly fine on my compiler . Try to submit it, it will get accepted.
Broo
Ek baat btaado bas
Uxp waala function define nhi horha
baaki mene sab krliya
Kaise krenge wo btaado plz
nd I have even tagged you in that doubt too.
Ohho Chlo Mai bta Deta hu
Uxp function kya krega, woh sbse pehle xth element ko find krega fr joh xth element ka next element hoga(right side par) usko link krdega pth position distance away from x. Pr yaha catch hai, jaise ki maan lo pth distance se pehle he linked list khtm ho jatti hai, then tumhe kya krna hoga ki iterate kro jb tk last element ni mil jatta, or uska count yaad rkho. Or fr (p-count) distance from x pr uss node ko place krdo. Aise perform krke ho jayega.
Bro yeh shi hain.
Insufficient mein dikkat aarhi.
Yaar shi toh hai, accept no Jana Chhiye . Maine joh smjhaya woh smjh Mai Aaya na?
void uxp(node*&head,int x,int p)
{
//2 Cases
//1. Sufficient Nodes
//2. Insufficient Nodes
node* temp1=head;
node* temp2=head;
int pos=searching(head,x);
cout<<pos<<endl;
while(pos–)
{
temp1=temp1->next;
//Insufficient Condition
temp2=temp2->next;
}
while(p--)
{
temp2=temp2->next;
if(temp2->next==NULL)
{
break;
}
}
if(temp2->next!=NULL)
{
//Insufficient Nodes nhi hain
//Simply alag krdo
temp1->next=temp2;
return;
}
else
{
//Insufficient Condition.
//Now we know temp2->next=NULL
//Insufficient Nodes hain ton simply temp2->next=head se connect krdo
//so It will be circular.
//But ek panga aur padega yahan pe
//Kuch ek aur condition bhi mentioned hogi jisse last test case galt horha mera.
temp2->next=head;
return;
}
}
Bro yeh jyaada shi lagi
Han aagya
but pehle mene Inssuficient condition nhi daali thi
ab likhi
shi hai na?
Arey haa, ab shi lg rha hai.
Btw, I am impressed that you have taken my suggestions seriously and have started doing competitive programming
Nhi bro
Abhi thoda galat hain
Like Second Last Case dekho
Like isme mene 7 ko direct 1 se connect krdiya
But dhyan se dekho
2 ko bhi alag krdiya isne.
It means kuch aur pnga hain
Han Bhai
Ab krna pdega hi
6 Months mein Internship season bhi aarha
Mei thapar mei hu
Bhut kam bache select hote for Internship
Like 10 in 1500
Iss baar itne hue
but koi na prep ton kr skte
leetcode nd cp pe
achaa rhega
Yaar is me thoda circular linked list bhi hai. Kaifi creeped out question hai.