A lot of people are complaining about you not explaining what you're doing but there are dozens of videos that go in depth on why quicksort works with graphics and everything, I just came here to find a guide on how to code it, and thats exactly what I got. Thanks
(10), 9 ,8 ,7, [6], 5, 4, 3, 2, (1) OP didn't explain his implementation, so if you don't understand it, trace it on a piece of paper. That said, I'll try to provide a rough summary of what's happening. In QuickSort we can choose to the pivot to be any value, but in our case we choose the middle of the array to be the pivot. On the first iteration that means that our pivot is index 4 or 6. And our int left = 0 and int right = 9 or value 10 and 1 respectively. The while loops in the partition method are responsible for finding indexes of values that are on the wrong side of the pivot, recall that a smaller values goes to the left of the pivot whereas the larger goes to the right of the pivot. Our initial values of left and right are 10 and 1. 10 is not less than our pivot (6) and neither is 1 greater than our pivot, so that means both these values need to be on the other side, so just swap them. In the case that the value on the left is already less than our pivot already (or vice versa for right side), then that's great, it's right where it needs to be so left++ (or vice versa for the right side) until you find two values that do need to be swapped. You'll find that in the end, the left and right index will be equal to each other, so at one point you will perform a swap on the same indexes, which ultimately does nothing. It doesn't matter which index you return at this point, OP chooses left, and then we recursively call QuickSort on the leftside subarray from the pivot and the subarray on the right of the pivot.
Please understand the pain of a mother namaste we are brahmins works in small temple we are having two little kids of 4,6 year old due to some health problems doctor said there is a need of operation we are poor family we need help please wholeheartedly help me my gpay phpay no.9014095234 andhrabank a/c name AnandSharma a/c 014710100191266Ifsc ANDB0000147 the small help of you will help my family to survive 🙏
Please understand the pain of a mother namaste we are brahmins works in small temple we are having two little kids of 4,6 year old due to some health problems doctor said there is a need of operation we are poor family we need help please wholeheartedly help me my gpay phpay no.9014095234 andhrabank a/c name AnandSharma a/c 014710100191266Ifsc ANDB0000147 the small help of you will help my family to survive 🙏
Please understand the pain of a mother namaste we are brahmins works in small temple we are having two little kids of 4,6 year old due to some health problems doctor said there is a need of operation we are poor family we need help please wholeheartedly help me my gpay phpay no.9014095234 andhrabank a/c name AnandSharma a/c 014710100191266Ifsc ANDB0000147 the small help of you will help my family to survive 🙏
A lot of people are complaining about you not explaining what you're doing but there are dozens of videos that go in depth on why quicksort works with graphics and everything, I just came here to find a guide on how to code it, and thats exactly what I got. Thanks
(10), 9 ,8 ,7, [6], 5, 4, 3, 2, (1)
OP didn't explain his implementation, so if you don't understand it, trace it on a piece of paper. That said, I'll try to provide a rough summary of what's happening. In QuickSort we can choose to the pivot to be any value, but in our case we choose the middle of the array to be the pivot. On the first iteration that means that our pivot is index 4 or 6. And our int left = 0 and int right = 9 or value 10 and 1 respectively.
The while loops in the partition method are responsible for finding indexes of values that are on the wrong side of the pivot, recall that a smaller values goes to the left of the pivot whereas the larger goes to the right of the pivot. Our initial values of left and right are 10 and 1. 10 is not less than our pivot (6) and neither is 1 greater than our pivot, so that means both these values need to be on the other side, so just swap them.
In the case that the value on the left is already less than our pivot already (or vice versa for right side), then that's great, it's right where it needs to be so left++ (or vice versa for the right side) until you find two values that do need to be swapped.
You'll find that in the end, the left and right index will be equal to each other, so at one point you will perform a swap on the same indexes, which ultimately does nothing. It doesn't matter which index you return at this point, OP chooses left, and then we recursively call QuickSort on the leftside subarray from the pivot and the subarray on the right of the pivot.
you typed the algorithm nicely but didn't offer any explanations to help facilitate any understanding of why it works!
Very smoothly and convincingly written code!! Thank you Sir!!
It's been 8 years, how's life bro?
What if we keep first index as pivot
I was searching for easy way to implement this quick sort and sir you helped me.. ty
Please understand the pain of a mother namaste we are brahmins works in small temple we are having two little kids of 4,6 year old due to some health problems doctor said there is a need of operation we are poor family we need help please wholeheartedly help me my gpay phpay no.9014095234 andhrabank a/c name AnandSharma a/c 014710100191266Ifsc ANDB0000147 the small help of you will help my family to survive 🙏
Why you returning left? why not right value?
Who is here from Mr. Lu's class
nice example, keep it up 👍👍
Hi Sir,
Can i have a code of this? i don't know how to create
Thank you
"Quick Sort Algorithm in C# With Activation Log and Control Stack"
I am getting a lot of things from your video. Great.
this program is not completely correct, somewhere it is loosing if we give different inputs
{24,2,45,20,56,99,2,56,101,53,12} I used this aaray and its not working.
It´s working by me
thanks for posting. This is what i wanted to see for code implementation.
anyone can write the code but not everyone can explain the code. you kept on typing without explaining anything..lol
Please understand the pain of a mother namaste we are brahmins works in small temple we are having two little kids of 4,6 year old due to some health problems doctor said there is a need of operation we are poor family we need help please wholeheartedly help me my gpay phpay no.9014095234 andhrabank a/c name AnandSharma a/c 014710100191266Ifsc ANDB0000147 the small help of you will help my family to survive 🙏
deivam ya nee
simple !!!!!!!!!!!!!!!!?
Wrong solution, lol
you are just copying ..
Please understand the pain of a mother namaste we are brahmins works in small temple we are having two little kids of 4,6 year old due to some health problems doctor said there is a need of operation we are poor family we need help please wholeheartedly help me my gpay phpay no.9014095234 andhrabank a/c name AnandSharma a/c 014710100191266Ifsc ANDB0000147 the small help of you will help my family to survive 🙏