Quick Sort For Beginners | Strivers A2Z DSA Course

  Рет қаралды 529,119

take U forward

take U forward

Күн бұрын

Пікірлер: 534
@takeUforward
@takeUforward Жыл бұрын
Let's march ahead, and create an unmatchable DSA course! ❤ The worst case complexity will be O(N ^ 2) if we end up choosing the largest or smallest element as the pivot always. We will add this in the notes in the description. I missed this in the video.
@yashhokte1020
@yashhokte1020 Жыл бұрын
Yes striver , even i was thinking same that you didn't explain this thing , btw thankyou so much for this much crystal clear explaination ..
@anookimmidisetty2939
@anookimmidisetty2939 Жыл бұрын
Hi striver @takeUforward , when are you going to release video solutions for string type problems and heaps?
@yaswanthmitta8983
@yaswanthmitta8983 Жыл бұрын
There is a minor mistake in your algo at 23:54 in while loop condition must be arr[i]
@teen_python_go9947
@teen_python_go9947 10 ай бұрын
Since, we are always choosing pivot to be the first element of the array, we can always avoid the O(n^2) case by pre-checking if the array is pre-sorted (with O(n) Time Complexity) and if it is not then only feed it into the quick sort function.
@yashsharma6112
@yashsharma6112 Жыл бұрын
I have to state it that "I tried to learn all sorting techniques various time. I learned but after a few days I forgot. But when you just added the real meaning of each sorting techniques. Like why it is called as selection sort and so on.... SO now I just remember their meanings and write the algorithm on my own." Thank you very much. Loved your teaching style
@vedantgolash6084
@vedantgolash6084 9 ай бұрын
same here
@anusha6033
@anusha6033 9 ай бұрын
same heree
@chiranjeebpanda8926
@chiranjeebpanda8926 8 ай бұрын
same here
@nimishjais9666
@nimishjais9666 6 ай бұрын
Same
@ictfan-ly8gh
@ictfan-ly8gh 5 ай бұрын
Not same 😢
@deepanshuthakur140
@deepanshuthakur140 Жыл бұрын
I tried to learn this from every yt channel but striver is the one i got it from, respect++
@navagharkiran5769
@navagharkiran5769 5 ай бұрын
then you haven't tried Abdul Bari
@deepanshuthakur140
@deepanshuthakur140 5 ай бұрын
@@navagharkiran5769 sadly I did, its not that abdul bari is not good, its me who is dumb uk but striver made me understand it anyhow
@parshuramry1657
@parshuramry1657 4 ай бұрын
@@navagharkiran5769 abdul bari is better for college academics but striver is for campus selections
@Kaushik846
@Kaushik846 Жыл бұрын
Probably one of the crisp and to the point explanation of quick sort algorithm available online!!
@kingreja5894
@kingreja5894 Жыл бұрын
//for descending while (arr[i]>=pivot && i
@PunjabPrank
@PunjabPrank Ай бұрын
yes i am thinking about this mistake ..thank you
@omkarsawant9267
@omkarsawant9267 Жыл бұрын
Quick Sort's in-place partitioning makes it more memory-efficient than Merge Sort in practice, but the worst-case space complexity can be higher when the partitioning is unbalanced. Time Complexity: Best Case: O(n log n) when the pivot choices consistently lead to balanced partitions. Average Case: O(n log n) Worst Case: O(n^2) when the pivot choices consistently lead to unbalanced partitions. However, with good pivot selection strategies (e.g., using the median element), this can be mitigated. Space Complexity: O(log n) auxiliary space for the recursive call stack in the best and average cases. O(n) in the worst case when the partitioning is highly unbalanced. Quick Sort's in-place partitioning makes it more memory-efficient than Merge Sort in practice, but the worst-case space complexity can be higher when the partitioning is unbalanced. Quick Sort tends to perform well in practice and is often faster than other O(n log n) algorithms, but its worst-case time complexity is worse than Merge Sort. Merge Sort's space complexity makes it less memory-efficient compared to some other sorting algorithms, but its stable performance and guaranteed O(n log n) time complexity in all cases make it a preferred choice for certain scenarios. Space Complexity: O(n) additional space is required for the temporary arrays during the merging process. It has a space complexity of O(n) due to the need for additional space for merging.
@Jinntechive
@Jinntechive 9 ай бұрын
Appreciate the effort you put for writing this comment 😇❤
@nayankhuman1043
@nayankhuman1043 8 ай бұрын
Thanks for the comment. i was looking for it.
@dreamer12n
@dreamer12n 6 ай бұрын
Hey can you give me the code for pivot = median element pls??
@onlyone7209
@onlyone7209 3 ай бұрын
​@@dreamer12nwhat kind of code do you want
@itsmehere8285
@itsmehere8285 3 ай бұрын
​@@dreamer12nJust set pivot = (low + high)/ 2 or in a better way to deal with larger numbers make it low +(high -low)/2
@ParasSharma-mf8or
@ParasSharma-mf8or Жыл бұрын
Thanks for this amazing lecture,this is my humble request please complete this course as soon as possible.
@adityamaheshwari4250
@adityamaheshwari4250 Жыл бұрын
Really you make everything a cakewalk! Thank you so much sir, it takes a big heart to do such a lot for the community for free❤
@FunkyPanda6263
@FunkyPanda6263 Жыл бұрын
1 video every 2 days... Seems TRUE ❣️
@parthmangalkar
@parthmangalkar Жыл бұрын
Understood! Thank you!! You are the best! Thanks a lot for making this DSA playlist! It really is helping me a lot!
@isaacreyes7563
@isaacreyes7563 6 ай бұрын
Damn, I have been looking at sort, recursion, etc forever. I was first confronted with merge/quicksort back in 2019. Been looking at them from various other sources over the years but nobody ever explained it like you do. You are absolutely amazing at this stuff. Idk where you are in life but I hope you go onto make amazing things because someone with this in depth knowledge shouldn't be stuck teaching!
@tanmayjivnani865
@tanmayjivnani865 6 ай бұрын
Don't worry he is working at Google. Doing great in life :)
@AdityaSharma-hs8os
@AdityaSharma-hs8os Жыл бұрын
please upload full course you are douing a good job bhaiyaaa ,you are really a honest teacher other youtubers who has million subscribers just make us fool on name of dsa course ,they just tell the problem and paste the soultion but you solve every aspect -f our doubt please cpmplete this and dont worry of views and watch time,time will come when everyone will know who is the best teacher on youtube for dsa
@animeshmishra6280
@animeshmishra6280 Жыл бұрын
how do you know which doubts are going to come in my mind. GREAT LECTURE SIR 🔥
@edisane8763
@edisane8763 Жыл бұрын
Because once he was also in the same place as we are now and he worked hard to reach this point now he is helping us
@alessandrocamilleri1239
@alessandrocamilleri1239 Жыл бұрын
Excellent explanation as usual. Thank you. I am posting the iterative version which should further save on recursion call stack space. I have used a queue as the data structure but stack works just as well. void quickSort (vector &nums) { int n = nums.size(); queue q; q.push({0, n-1}); int low, high, pivot, i, j; while(!q.empty()) { low = q.front().first; high = q.front().second; q.pop(); if (low >= high) continue; pivot = nums[low]; i = low; j = high; while (j > i) { while (nums[i] pivot && j > 0) j--; if (j >= i) swap(nums[i], nums[j]); } swap (nums[low], nums[j]); q.push({low, j-1}); q.push({j+1, high}); } }
@balakrishnanr648
@balakrishnanr648 Жыл бұрын
So Yah u tried the iterative version of Quick Sort but still you are using the space what the Recursive func calls use in func call stack in the QUEUE FORM. O(logN) Queue takes as extra space. Like the point is Quick sort no matter what -> You can further optimize. Func Stk Space or in Iterative normal stack or queue space is needed. As we need to store it somewhere -> what are the next range of places where it is unsorted. Either use the system's func call stack or make ur own.
@pranshuatrey
@pranshuatrey Жыл бұрын
This is gold... Plz keep doing this..
@active_akasa8429
@active_akasa8429 Жыл бұрын
striver you are the best out of best....this tutorial is just amazing and you are like god for us A big thank you so much for your effort 🙂
@ArunKumar-sk9jl
@ArunKumar-sk9jl 6 ай бұрын
A great man with the best of the best teaching skills and a kind attitude to make it free is awesome ❤
@keshariaman
@keshariaman Жыл бұрын
Thanks a lot for Quick Short. Feels easier to understand 🥰
@ShivamGupta-xw6gh
@ShivamGupta-xw6gh Жыл бұрын
best explanation of quick sort on youtube
@makerNg1817
@makerNg1817 Жыл бұрын
it's very understandable way you teach. thank you for this amazing lecture
@mityamkumar1158
@mityamkumar1158 Жыл бұрын
Understood.... 💯💯 Excited for Arrays playlist❤
@darkelixir2517
@darkelixir2517 Жыл бұрын
Understood, will be a quick way to remember the algorithm, well taught!! Thanks
@Manishgupta200
@Manishgupta200 Жыл бұрын
Here is my Assignment question solution : #include using namespace std; int partition(vector &arr, int low, int high){ int pivot = arr[low]; int i = low; int j = high; while(i < j){ while(arr[i] >= pivot && i = low + 1) j--; if(i < j) swap(arr[i], arr[j]); } swap(arr[low], arr[j]); return j; } void qs(vector& arr, int low, int high){ if(low < high){ int pIndex = partition(arr, low, high); qs(arr, low, pIndex - 1); qs(arr, pIndex + 1, high); } } int main(void){ // vector v = {4, 3, 2, 1}; vector v = {4, 3, 2, 1, 4, 7, 5, 6}; int n = v.size(); qs(v, 0, n-1); for(auto it : v) cout
@shubhamagarwal1434
@shubhamagarwal1434 6 ай бұрын
#Free Education For All...... # Bhishma Pitamah of DSA...You could have earned in lacs by putting it as paid couses on udamey or any other elaerning portals, but you decided to make it free...it requires a greate sacrifice and a feeling of giving back to community, there might be very few peope in world who does this...."विद्या का दान ही सर्वोत्तम दान होता है" Hats Off to you man, Salute from 10+ yrs exp guy from BLR, India.......
@gurudev8543
@gurudev8543 Жыл бұрын
Best explanation ever ❤️❤️❤️ Thanks bhaiya
@rayyanrahim7413
@rayyanrahim7413 Жыл бұрын
love from pakistan we need these type of legend to teach progamming
@tanmaykarmakar6224
@tanmaykarmakar6224 Жыл бұрын
Quick sort in Descending order-(PYTHON) arr=[25,1,8,7,32,2,5] def piviot(arr,high,low): piviot=arr[high] i=high j=low while(i=piviot and i
@sumitapathak2900
@sumitapathak2900 Жыл бұрын
Hey I haven't done a dryrun of your code but as i has index of high how can in increment in the while loop?
@jayaveersai1446
@jayaveersai1446 Жыл бұрын
yes make sense and have to chnage the while (i
@nirmaljyotibiswas752
@nirmaljyotibiswas752 4 ай бұрын
shouldn't it be while(i > j) ?
@CodeBoost8375
@CodeBoost8375 Жыл бұрын
Thanks for recursive effort brother.And till now all your lectures are absolutely awesome 🔥🔥
@rajkumarvb5197
@rajkumarvb5197 Жыл бұрын
Manhhhh 🥵, you are awesome. I can see the effort you are putting in! Thanks a lot! ❤
@ahssanakhtar5746
@ahssanakhtar5746 9 ай бұрын
Excellent content about DSA .I am follwing you A-Z coarse and improve my self in DSA day by DSA Thanks for making such a amazing content
@madhumithaakula7666
@madhumithaakula7666 3 ай бұрын
Thank You anna because of u I have learned something new today🙂
@Manoj_IIC-Admin
@Manoj_IIC-Admin Жыл бұрын
at time 23:52 it should be pivot not ar[pivot] thanks bhaiya
@Jaishreeram-ly2jm
@Jaishreeram-ly2jm 4 ай бұрын
Yes bro.👊 😊
@adityamukherjee2207
@adityamukherjee2207 2 ай бұрын
bro you are a true saviour !!
@tusharkhandave374
@tusharkhandave374 Жыл бұрын
Thanks for giving this content for free it helps me a lot
@shubhamsahu492
@shubhamsahu492 3 ай бұрын
Your explanations are the best 💕👌👌
@abdulwahabshaik1686
@abdulwahabshaik1686 Жыл бұрын
Understanding everything u r teaching to us u r magician striver
@AniketSingh-gm9nh
@AniketSingh-gm9nh 6 ай бұрын
u r just amazing. keep educating man u r blessing for us.❤
@onetapgaming123-v2x
@onetapgaming123-v2x 5 ай бұрын
16 Aug 2024, 2:00 a.m.🎯🔥
@pradeep6635
@pradeep6635 9 ай бұрын
understood Bhayya.The best explanation in youtube😎
@subhadeepghosh2813
@subhadeepghosh2813 Жыл бұрын
Kaha se sikha hai aise padana? vai koi vi nahi hai tumhare jaisa. Maza aa gaya
@sonalikharwar4269
@sonalikharwar4269 Жыл бұрын
Instead of 3,2,1 it should be 1,3,2 coz we have done swapping b/w 4 & 1 like swap(arr[low], arr[j]) right ?
@OmPrakash-268
@OmPrakash-268 5 ай бұрын
awesom explanation , love it learning DSA .
@SharathS-s9i
@SharathS-s9i 5 ай бұрын
for the assigment problem just change the condition while (i < j) { while (arr[i] > pivot && i
@yashlakade179
@yashlakade179 2 ай бұрын
Thanks Striver :)
@CycoTrend
@CycoTrend Ай бұрын
bro is the angel!
@hemantyadav6198
@hemantyadav6198 Ай бұрын
Awesome explaintion ❤
@manish_mnnit
@manish_mnnit Жыл бұрын
For Descennding Order Sorting -> //Just Reverse the inequality sign in partition function :- #include int partition(vector&arr,int low,int high){ int pivot =arr[low]; int i=low ,j=high; while(i
@prithukathet193
@prithukathet193 Ай бұрын
tusi great ho tofa Kabul karo.
@scoc55vora15
@scoc55vora15 Жыл бұрын
Best , Detailed and Crisp
@shivamcanada
@shivamcanada 6 ай бұрын
very well explained brother appreciate your efforts
@rishabhkumar-qs3jb
@rishabhkumar-qs3jb 9 ай бұрын
Excellent explanation :)
@bonammadankumar681
@bonammadankumar681 11 ай бұрын
You rocks the DSA
@rohanraj2604
@rohanraj2604 Жыл бұрын
Crystal clear bhaiya 😍
@Malayalam_learner
@Malayalam_learner Ай бұрын
Why not ilow Can anyone explain why striver doesn't take these ??
@sakshamtyagi2969
@sakshamtyagi2969 11 ай бұрын
Completely Understood 👍👍
@SwatiSingh-ys6hm
@SwatiSingh-ys6hm Жыл бұрын
Damn it, i have learnt sorting algorithms a lot of times, but i aways manage to somehow forget.But after seeing this video now i understand it in so much more detail and depth which i earlier didn't even notice. thanks you soo much striver !
@hareshnayak7302
@hareshnayak7302 10 ай бұрын
Understood,Thanks striver for this amazing video.
@manavsingh5919
@manavsingh5919 Жыл бұрын
Understood sir.....u r the best👍💞
@yhbarve
@yhbarve Жыл бұрын
Understood bhaiya! Thank you
@meshkatuddinahammed
@meshkatuddinahammed Жыл бұрын
Can't thank you more. Great lectures. Appreciate it.
@tamoghnasaha2667
@tamoghnasaha2667 Ай бұрын
Why we are using while (i
@anuragpawar4497
@anuragpawar4497 17 күн бұрын
Step-2 completed! Understood
@Pawankumar-i8c
@Pawankumar-i8c 3 ай бұрын
thank you so muchbhiaya for this masterpiece
@zyzzbrah9429
@zyzzbrah9429 8 ай бұрын
int partition (int arr[], int low, int high) { int p=arr[low]; int i=low,j=high; while(i=p && i
@shailesh3348
@shailesh3348 8 ай бұрын
I also completed 2 steps can we connect?
@Kirito045
@Kirito045 Жыл бұрын
Understood Striver on TOP!
@Gcoder18
@Gcoder18 3 ай бұрын
nice way of explaination
@student_03
@student_03 5 ай бұрын
checking for out of bounds like this makes it simple and natural while (i pivot) { j--; }
@tasneemayham974
@tasneemayham974 Жыл бұрын
CODE FOR DESCENDING (JAVA): public void quickSort(int[] arr, int low, int high){ if(low low){ j--; } if(i
@DineshKumar-pw7qb
@DineshKumar-pw7qb Жыл бұрын
When I try to run this code(using array), I getting no output and the code runs for infinite time. When I try with ArrayList, I am getting output. Explain why? This put me into severe headache
@tasneemayham974
@tasneemayham974 Жыл бұрын
@@DineshKumar-pw7qb Heyy!! You mean my code? Either way, can you send me the code you are working on. I want to try it. How about that? Maybe we can fix it together?
@DineshKumar-pw7qb
@DineshKumar-pw7qb Жыл бұрын
@@tasneemayham974bro are sure about your code is working well with array?
@tasneemayham974
@tasneemayham974 Жыл бұрын
@@DineshKumar-pw7qb Hey, mate! I copied my code, and yes it works with arrays. It doesn't give me errors or infinite loops, but... this line: while(arr[i] > pivot && i < high) I missed the =. I am so sorry. I should be: while(arr[i] >= pivot && i < high) Check it out now. But as I understand, the problem with your code is the array itself, yes? Not the output? If you want you can send the code. Because mine works well with array. P.S.: I will edit the original comment, and put the equal.
@cinime
@cinime Жыл бұрын
Understood! Super amazing explanation as always, thank you very much!!
@THE-MYSTIC
@THE-MYSTIC Жыл бұрын
Thanks striver this video helped me ❤
@makingthamilan1592
@makingthamilan1592 Жыл бұрын
you are my God , thanks man 🥰
@Hipfire786
@Hipfire786 10 ай бұрын
understood everything sir so far all sorting techniques
@AbhishekKumar-cd4gg
@AbhishekKumar-cd4gg Жыл бұрын
// for descending order just we have to do the tweaks in the how we are selecting elements when which we are stopping when we are finding element smaller in left and stop when we find the element greater the pivot then we just we swap it than it goes in the recursion stack public class Quicksort { static int partiton(int arr [] , int low , int high ){ int pivot = arr[low]; int i= low; int j = high; while (i < j ) { while (arr[i] >= pivot && i = low + 1 ) { j--; } if(i < j ){ int temp = arr[i]; arr[i] = arr [j]; arr[j] = temp; } } int temp = arr[j]; arr[j] = arr[low]; arr[low] = temp; return j ; } static void quicksort(int arr [] , int low , int high){ if(low < high ){ int PartionIndex = partiton(arr,low,high) ; quicksort(arr, low , PartionIndex-1); quicksort(arr, PartionIndex+1 , high); } } public static void main(String[] args) { int arr [] = {10, 80, 30, 90, 40}; int n = arr.length-1; quicksort(arr, 0, n); for (int i : arr) { System.out.print(i + " "); } } }
@poojaraman6663
@poojaraman6663 7 ай бұрын
Understood...thank u sir🙂
@samarthpai5359
@samarthpai5359 5 ай бұрын
Understood sir. For descending order: int partitionFunction(int arr[], int low, int high){ int i = low, j = high, temp; int pivot = arr[low]; while(ipivot and i
@user-kk4qv5fy6k
@user-kk4qv5fy6k 4 ай бұрын
Why can't we give while (i
@The_Shubham_Soni
@The_Shubham_Soni 8 ай бұрын
Best Teacher
@lwnflash2123
@lwnflash2123 9 ай бұрын
Is recursive stack space not required while computing space somplexity?
@saranshgautam3011
@saranshgautam3011 Жыл бұрын
Why do we ignore recursion stack space when calculating Space Complexity? I think that should count.
@soumelee5661
@soumelee5661 Жыл бұрын
Awesome explanation! TYSM for the videos
@yashpandey7
@yashpandey7 8 ай бұрын
understood , Step 2 completed :)
@Gurunat16
@Gurunat16 7 ай бұрын
26:58 That will be |1 3 2| 4. Right?
@ankit-yj7hk
@ankit-yj7hk 8 ай бұрын
understand bhaiya !!! thank uh so much
@harshalparanjiya5850
@harshalparanjiya5850 Ай бұрын
let's go --> 20 december 🔥🔥
@ankiitttkmmm
@ankiitttkmmm Жыл бұрын
man you awesome Thanks
@joydeepdas29
@joydeepdas29 Жыл бұрын
Understood 😄. But will you please explain why we swapped between (arr[j] , arr[low]) instead of (arr[j], pivot)?
@takeUforward
@takeUforward Жыл бұрын
I will recommend you to take examples and do a dry run, that will help you immensely to learn! I can answer, but finding out yourself on pen and paper is what will help you grow :)
@joydeepdas29
@joydeepdas29 Жыл бұрын
@@takeUforward Thank you. I will surely do as suggested 😄.
@elizabethr5161
@elizabethr5161 Жыл бұрын
We have taken low as a pivot, so it doesn't matter whether we swap it with low or pivot.
@Anonymous-ej2xo
@Anonymous-ej2xo Жыл бұрын
@@elizabethr5161 No it will matter because you want the swapping to occur between the elements of the array. With what you are saying, the j-th position will get the correct value, but 'low' position will not have been swapped. The swapping needs to occur in the array. You are getting confused as the values being swapped are effectively the same, but where the swap occurs is not the same.
@prajjwalkohli9830
@prajjwalkohli9830 Жыл бұрын
pivot is just some another independent variable having same value as arr[low], swapping with pivot means swapping values with an independent variable, we want swapping with the array's low itself so we explicitly use arr[low] here.
@raynwani137
@raynwani137 6 ай бұрын
Love you bhai!
@____Akash__
@____Akash__ Жыл бұрын
After long time ❤️❤️
@krishnakanttiwari517
@krishnakanttiwari517 Ай бұрын
Thank You So Much Sir
@ByteBuilder-b6u
@ByteBuilder-b6u 6 ай бұрын
Should be include stack space in recursion problems while stating space complexity ?
@AbdullahKhan-et6qo
@AbdullahKhan-et6qo Жыл бұрын
Was eagerly waiting for your videos 🙌
@arnavanant3049
@arnavanant3049 Жыл бұрын
you are OP bhaiya
@_hulk748
@_hulk748 Жыл бұрын
Thank you sir🙇‍♂️🙏❤
@JothiprakashThangaraj
@JothiprakashThangaraj 6 ай бұрын
Understood!! Thanks!!!
@dayashankarlakhotia4943
@dayashankarlakhotia4943 Жыл бұрын
Good explanation us
@shreyashkumarsahu5985
@shreyashkumarsahu5985 7 ай бұрын
understood Thanks a lot sir
@DeepakKumar-xj4ul
@DeepakKumar-xj4ul 11 ай бұрын
for decreasing Quick Sort:- int partition(vector &arr, int low, int high) { int pivot = arr[low]; int i = low; int j = high; while (i < j) { while (arr[i] >= pivot && i = low + 1) { j--; } if (i < j) { swap(arr[i], arr[j]); } } swap(arr[low], arr[j]); return j; } void quickSort(vector &arr, int low, int high) { if (low < high) { int pIndex = partition(arr, low, high); quickSort(arr, low, pIndex - 1); quickSort(arr, pIndex + 1, high); } } vector sortArray(vector &arr) { quickSort(arr, 0, arr.size() - 1); return arr; }
@techniciangurugaming5020
@techniciangurugaming5020 7 ай бұрын
UNDERSTOOS VERY WELL
@preetisahani5054
@preetisahani5054 Жыл бұрын
Its a great video, but you should also explain the cases where complexity for quick sort can result to O(n^2) in the case where all elements of array are same and when array is already sorted, in those cases partition will always be 1, n-1.
@krishnendughosh2368
@krishnendughosh2368 Жыл бұрын
sorted or even if sorted in descending order complexity will be n^2
@adityabedi266
@adityabedi266 15 күн бұрын
22-01-2025 completed this topic learn a lot about quick sort. Thanks sir 😊 //code in java package Sorting; import java.util.Arrays; public class QuickSort { public static void main(String[] args) { int[] arr= {8, 3, 9, 2, 5, 6, 4, 1}; quickSort(arr, 0, arr.length-1); System.out.println(Arrays.toString(arr)); } static void quickSort(int[] arr, int low, int high){ if(low
@basusingg4882
@basusingg4882 Жыл бұрын
Very well understood!
@sugarfreecode
@sugarfreecode Жыл бұрын
Quick Sort in Descending Order (C++): int partitionArray(int input[], int start, int end) { int pivot = input[start]; int i = start; int j = end; while (i < j) { while (input[i] >= pivot && i < end) { i++; } while (input[j] < pivot && j > start) { j--; } if (i < j) { int temp = input[i]; input[i] = input[j]; input[j] = temp; } } input[start] = input[j]; input[j] = pivot; return j; } void quickSort(int input[], int start, int end) { if (start >= end) return; int partition = partitionArray(input, start, end); quickSort(input, start, partition - 1); quickSort(input, partition + 1, end); }
“Don’t stop the chances.”
00:44
ISSEI / いっせい
Рет қаралды 62 МЛН
Chain Game Strong ⛓️
00:21
Anwar Jibawi
Рет қаралды 41 МЛН
The evil clown plays a prank on the angel
00:39
超人夫妇
Рет қаралды 53 МЛН
BRAIN ROT | Why You Are Losing Control Of Your Brain?
17:40
Aevy TV
Рет қаралды 1,3 МЛН
5 Secrets to Stop Stuttering & Speak More Clearly!
12:44
Vinh Giang
Рет қаралды 137 М.
2.8.1  QuickSort Algorithm
13:43
Abdul Bari
Рет қаралды 3,4 МЛН
How to Remember Everything You Read
26:12
Justin Sung
Рет қаралды 3,9 МЛН
L8. Combination Sum | Recursion | Leetcode | C++ | Java
27:00
take U forward
Рет қаралды 686 М.
Major Announcement | TUF+ V2 and System Design Playlist 🔥
19:12
take U forward
Рет қаралды 79 М.
Learn Quick Sort in 13 minutes ⚡
13:49
Bro Code
Рет қаралды 445 М.
“Don’t stop the chances.”
00:44
ISSEI / いっせい
Рет қаралды 62 МЛН