Find the k th Smallest/Largest Element | Quick Select Algorithm | Optimizing Quick Sort

Описание к видео Find the k th Smallest/Largest Element | Quick Select Algorithm | Optimizing Quick Sort

Finding Kth largest and smallest element of an array in an Optimized way is common software coding interview question asked in amazon, google, facebook, microsoft coding interview round.

Here you are given an array of number and an integer K, you need to find the Kth smallest number in the array.

There are multiple ways:
1) Brute Force way: Sort the array and the return the kth element of array, time complexity for this is O(nlogn)
2) use extra space and go for min heap, space complexity for this is o(n) and time is O(nlogk)
3) Optimized solution : Use Quick select, which is an optimization on top of quick sort. This algorithm in it's worst case will give o(n2) time complexity but in average case it will run with time complexity of O(n).

In this video I have described how quick select works and implemented it as well. You can get the code from below mentioned github link.

subscribe to the channel to get more content on :
1) job interview
2) softwares
3) systems design
4) cracking the coding interview
5) algorithms
6) system design interview questions
7) object oriented programming concepts
8) software design patterns

You can buy us a coffee at : https://www.buymeacoffee.com/thetechg...

system design:    • System Design | Distributed Cache | L...  

DS for beginners:    • Arrays Data Structures | Data Structu...  

leetcode solutions:    • Leetcode 84 | Largest Rectangle in Hi...  

github: https://github.com/TheTechGranth/theg...
facebook group :   / 741317603336313  
twitter:   / granthtech  

Комментарии

Информация по комментариям в разработке