sir there is one mistake.... we should do - - pivotindex in segregate so that pivot pointer lands on the correct pivot node... this makes the quick sort faster than current solution.
Thanks for liking and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
Thankyou I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem. If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
Hope yo like the video. visit on nados.pepcoding.com yo will find better experience with organised content. Don't forget to follow us on Instagram instagram.com/pepcoding/
If anybody get that tail thing please let me know also😢 how leftsortedlist![1] index can be tail.. there could be more than 2 elements in left sorted list then index 1 cant be tail...please correct me if I'm wrong...i didn't get this thing
leftSortedlist[1] is tail because quicksort_ function return 2 size array {head, tail}. Don't confuse between segregation returned array. the array return by segregation function returns that head of left and right partition and pivot node -> {leftHead, pivot, rightHead}, and after the recursive call when base case reached means we have null or single node the we are return arra with just head and tail after both left and right call we are merging. Dry run to get better understanding.
@@rishabhjain5199 leftSortedlist[1] is tail because quicksort_ function return 2 size array {head, tail}. Don't confuse between segregation returned array. the array return by segregation function returns that head of left and right partition and pivot node -> {leftHead, pivot, rightHead}, and after the recursive call when base case reached means we have null or single node the we are return arra with just head and tail after both left and right call we are merging. Dry run to get better understanding.
I made it my self without watching this video, because of u sir.
Your videos helped me to clear my basics and applying correct logic
first node ko bhi to pivot index le sakte hai
tab na length nikalna hai na pivot find karna hai
sir there is one mistake.... we should do - - pivotindex in segregate so that pivot pointer lands on the correct pivot node... this makes the quick sort faster than current solution.
God Level Explanation 🔥🔥Thank You sir
Very well explained sir 👌👌
Thanks for liking and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
nice sir
Thanks and welcome
awesomely explained
Thankyou
I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
bade miya(SM) bade miya, chote miya(RK) subahn allah!
Hope yo like the video.
visit on nados.pepcoding.com
yo will find better experience with organised content.
Don't forget to follow us on Instagram instagram.com/pepcoding/
Awesome !
Thank you! Cheers!
op video sir 👌👌👌👌!
Sir ye tail ko index 1 pe kase return krega ye smaj ni arha hh
Post your doubts on nados.pepcoding.com our community will help you out.
#include
using namespace std;
class Node {
public:
int data;
Node *next;
Node() : next(nullptr) {}
Node(int d) : data(d), next(nullptr) {}
};
class LinkedList : private Node {
Node *head;
Node *tail;
Node *revList(Node *head) {
if(head == nullptr || head->next == nullptr)
return head;
Node *ptr = revList(head->next);
Node *temp = head->next;
temp->next = head;
head->next = nullptr;
return ptr;
}
public:
~LinkedList() {deleteEntireList();}
LinkedList() : head(nullptr), tail(nullptr) {}
Node *getHead() {
return head;
}
Node *getTail() {
return tail;
}
void addBeg(int data) {
Node *temp;
if(head == nullptr && tail == nullptr) {
temp = new Node(data);
head = temp;
tail = temp;
return;
}
temp = new Node(data);
temp->next = head;
head = temp;
temp = nullptr;
}
void addEnd(int data) {
Node *temp;
if(head == nullptr && tail == nullptr) {
temp = new Node(data);
head = temp;
tail = temp;
return;
}
temp = new Node(data);
tail->next = temp;
tail = temp;
temp = nullptr;
}
void addAtPos(int pos, int data) {
if(pos next;
if(temp == nullptr) return;
i++;
}
if(temp->next == nullptr) {
addEnd(data);
return;
}
Node *newNode = new Node(data);
newNode->next = temp->next;
temp->next = newNode;
}
void deleteBeg() {
if(head == nullptr && tail == nullptr) return;
Node *temp = head;
if(head == tail) {
head = nullptr;
tail = nullptr;
delete temp;
temp = nullptr;
return;
}
head = head->next;
delete temp;
temp = NULL;
}
void deleteEnd() {
if(head == nullptr && tail == nullptr) return;
Node *temp = head;
if(temp->next == nullptr) {
deleteBeg();
return;
}
while(temp->next->next) {
temp = temp->next;
}
Node *ptr = temp->next;
temp->next = nullptr;
tail = temp;
delete ptr;
ptr = nullptr;
}
void deleteFromPos(int pos) {
if(head == nullptr && tail == nullptr) return;
if(pos next == nullptr) return;
while(i < pos - 2) {
temp = temp->next;
if(temp->next == nullptr) return;
i++;
}
if(temp->next->next == nullptr) {
deleteEnd();
return;
}
Node *ptr = temp->next;
temp->next = ptr->next;
delete ptr;
ptr = nullptr;
}
void deleteEntireList() {
Node *temp = head;
head = head->next;
while(head) {
delete temp;
temp = head;
head = head->next;
}
delete temp;
temp = head;
head = nullptr;
tail = nullptr;
}
void reverseList() {
Node *temp1 = head;
Node *temp2 = head;
head = tail;
tail = revList(temp1);
tail = temp2;
}
void printList() {
if(head == nullptr && tail == nullptr) {
cout
If anybody get that tail thing please let me know also😢 how leftsortedlist![1] index can be tail.. there could be more than 2 elements in left sorted list then index 1 cant be tail...please correct me if I'm wrong...i didn't get this thing
For better insights, visit nados.pepcoding.com, post your doubts, community will help you out there.
seeee 29:00
@@rishitripathi5617 bhai btaio kaise hua left[1] tail?
leftSortedlist[1] is tail because quicksort_ function return 2 size array {head, tail}. Don't confuse between segregation returned array. the array return by segregation function returns that head of left and right partition and pivot node -> {leftHead, pivot, rightHead}, and after the recursive call when base case reached means we have null or single node the we are return arra with just head and tail after both left and right call we are merging. Dry run to get better understanding.
@@rishabhjain5199 leftSortedlist[1] is tail because quicksort_ function return 2 size array {head, tail}. Don't confuse between segregation returned array. the array return by segregation function returns that head of left and right partition and pivot node -> {leftHead, pivot, rightHead}, and after the recursive call when base case reached means we have null or single node the we are return arra with just head and tail after both left and right call we are merging. Dry run to get better understanding.
Tail vala concept bilkul ni samaj aya 1 index p tail kha rakhi hu bhai iska jikar kha hh isme
Post your doubts on nados.pepcoding.com our community will help you out.
Same i also didn't get..
answer mila?
Hello sir, please tell Bhavesh sir to complete excel clone we are waiting for a long time sir please🙏🙏
Bhavesh sir ki shaadi hai kal
Wow🤩 Congratulations🥳 Bhavesh sir!
Shadi me nahi bulaya aapne hame🥺
English please