Kth smallest element in an array | Kth Largest element in an array | Heap | Priority Queue

  Рет қаралды 10,791

Coder Army

Coder Army

Күн бұрын

Пікірлер: 151
@CoderArmy9
@CoderArmy9 8 ай бұрын
3 Approaches se Problem Solve kiya hai, Bataiye fr, Maja Aaaya...
@pranavmittal9619
@pranavmittal9619 8 ай бұрын
Yes why not
@shrishtdev9961
@shrishtdev9961 8 ай бұрын
last wala method shi tha bhaiya❤❤❤❤❤
@shrishtdev9961
@shrishtdev9961 8 ай бұрын
last wala method shi tha bhaiya❤❤❤❤❤
@shrishtdev9961
@shrishtdev9961 8 ай бұрын
last wala method shi tha bhaiya❤❤❤❤❤
@be_a_DT
@be_a_DT 7 ай бұрын
Thank you sir ! Really Helpful
@SajanKumar-ef1ur
@SajanKumar-ef1ur 8 ай бұрын
the mentor , the instructor , specility - chamka dena concept ko , selfless, Thank you
@GamingArenaaa
@GamingArenaaa 8 ай бұрын
Easiest DSA topic till now💯💯🤟🤟🔥🔥
@kapilkhandelwal48
@kapilkhandelwal48 8 ай бұрын
mza aa agya bhaiya itne dino baad lecture dekh k
@Pallab01
@Pallab01 8 ай бұрын
3:Kth largest element in a stream: vector kthLargest(int k, int arr[], int n) { // code here //using min_heap priority_queuep; vectorans; for(int i=0;i
@smitallunawat6167
@smitallunawat6167 5 ай бұрын
Too good explanation... feel hi aa gaya bhaiya!!
@ManojSinghRawat-x2w
@ManojSinghRawat-x2w 8 ай бұрын
bhaiya hum appke sath hamesha bane rahenga ❤ aaj bhi last tak😎
@vijaysingh-n6p9j
@vijaysingh-n6p9j Ай бұрын
Bahut hi bdiya tha lecture
@divyanshrawat2859
@divyanshrawat2859 6 ай бұрын
hats off to your teaching sir.
@chanchalsoni7535
@chanchalsoni7535 5 ай бұрын
best content all over the you tube
@rahulsingh3418
@rahulsingh3418 6 ай бұрын
Best explanation
@ankitnegi5628
@ankitnegi5628 8 ай бұрын
Nice Bhaiya
@Sanataniblood-mb5pu
@Sanataniblood-mb5pu 5 ай бұрын
Another wonderful lecture
@utkarshsingh09
@utkarshsingh09 Ай бұрын
Hats off to you Sir 🙌🙌
@LisaPrasad66
@LisaPrasad66 2 ай бұрын
nice explanation sir
@CalmingVideos-qm3rn
@CalmingVideos-qm3rn 7 ай бұрын
Very knowledgeable video
@allinonemoviesyt
@allinonemoviesyt 8 ай бұрын
50:33 Homework - kth largest element in a stream vector kthLargest(int k, int arr[], int n) { // code here vector ans; priority_queue pq; for(int i=0; i
@punitsharma584
@punitsharma584 3 ай бұрын
best approaches❤❤❤❤❤❤✌✌
@universalmeditationmusic9299
@universalmeditationmusic9299 3 ай бұрын
nice series ❤
@aman_kumar9146
@aman_kumar9146 3 ай бұрын
thanks bhayiya for such great content
@Abc-rz4ps
@Abc-rz4ps 6 ай бұрын
Best teacher !!! 🙏🙏🙏
@mehwishzehra1356
@mehwishzehra1356 Ай бұрын
chamak gaya bhai.❤️
@SmritiSharma-vv7ib
@SmritiSharma-vv7ib 3 ай бұрын
Amazing Negi bhaiiii
@manish_kumar_iitg
@manish_kumar_iitg 2 ай бұрын
3: Kth largest element in a stream:- vectorans(n); priority_queue p; for(int i = 0; i
@hiteshsharma5034
@hiteshsharma5034 8 ай бұрын
Gud mrng bhaiya
@12krishna_creator
@12krishna_creator 8 ай бұрын
Chamak gya bhaiya 🎉🎉🎉🎉🎉
@ankitchoudhary2914
@ankitchoudhary2914 8 ай бұрын
don't know why but ajj ka class kuch jyada interesting thi😎😎😎😎😎
@tradun.s9760
@tradun.s9760 5 ай бұрын
best dsa playlist
@RohitSharma-wu8te
@RohitSharma-wu8te Ай бұрын
Rohit bhai tussi great ho
@sdtedit5165
@sdtedit5165 8 ай бұрын
bhaiya aap ni hote to pata ni hamara kya hota itna accha content log apne paid cources me bhi nahi dete
@VineetDixit
@VineetDixit 2 ай бұрын
thanks for the lecture
@AbhishekKumar-vd1po
@AbhishekKumar-vd1po 6 ай бұрын
great video
@codeadityavyshnav3018
@codeadityavyshnav3018 4 ай бұрын
great sir
@sirfrozenpenguin5486
@sirfrozenpenguin5486 5 ай бұрын
Nice Video Sir
@12krishna_creator
@12krishna_creator 8 ай бұрын
Chammak gya hai 🎉🎉🎉🎉🎉 thank you
@JaiShreeRam_A1
@JaiShreeRam_A1 5 ай бұрын
mzaa aaa gyaaaa BHAIYA
@mahimsunny-p1g
@mahimsunny-p1g Ай бұрын
vector kthLargest(int k, int arr[], int n) { priority_queuep; vectorans; for(int i=0;i
@tradeiteasyy
@tradeiteasyy 4 ай бұрын
Loved it
@asad_iliyas
@asad_iliyas 6 ай бұрын
Interesting
@heetpatel3037
@heetpatel3037 6 ай бұрын
Jai shree Ram ❤️ kya hi ajab padhato ho bhaiya bohot sahi please demotivate mat hona Arjuna ki tarah bas laksh par focus kijiye
@sonakshipatel-Tp
@sonakshipatel-Tp 7 ай бұрын
Nice bhaiya 🎉
@KaranSuthar_28
@KaranSuthar_28 8 ай бұрын
Maza aa gaya thank you bhaiya
@saumyachauhan174
@saumyachauhan174 6 ай бұрын
superb bhaiya♥♥
@allinonemoviesyt
@allinonemoviesyt 8 ай бұрын
59:23 Homework : Time Complexity :- 1. sabse pehle hum K1 elements ko priority queue me daalege to uska time time compleity hoga = O(K1logK1) 2. fir (N-K1) elements ko top elements se compare krege aur insert krege heap me , to uska time complexity hoga = O((N-K1)logK1) 3. fir hum (K2-1) elements ka new priority queue bnayege uska time complexity hoga = O((K2-1)log(K2-1)) 4. fir hum (N-K2+1) elements ko top elements se compare krege aur insert krege heap me , to uska time complexity hoga= O((N-K2+1)log((K2-1))) 5. fir hum K1 elements waale heap ke elements ka sum nikalege uska time complexity hoga = O(K1logK1) 6. fir hum K2-1 elements waale heap ke elements ka sum nikalege uska time complexity hoga = O((K2-1)log(K2-1)) overall time complexity in sb ka addition hoga Space Complexity :- 1. K1 elements ka priority queue bnayege to space use hoga = O(K1) 2. K2-1 elements ka priority queue bnayege to space use hoga = O(K2-1) overall space complexity hoga = O(K1 + K2 -1)
@karankumar3983
@karankumar3983 8 ай бұрын
Thanks buddy I
@saumyachauhan174
@saumyachauhan174 6 ай бұрын
time complexiety mei insertion and deletion dono hoga na to 2logk1 and 2 log(k2-1) karenge na?
@bharatmalik2756
@bharatmalik2756 8 ай бұрын
chamak gya bhaiya 😎
@game-pc7ei
@game-pc7ei 7 ай бұрын
Chamak gya bhaiya 😃
@rejaulislam2593
@rejaulislam2593 2 ай бұрын
alhamdulillah chamak gaya
@Aniruddha_Mukherjee
@Aniruddha_Mukherjee 8 ай бұрын
Problem 2 : ________________________________________ class Solution { public: int findKthLargest(vector& nums, int k) { priority_queue pq; for(int i = 0; i
@amorphous8826
@amorphous8826 Ай бұрын
Thank you sir
@pranavmittal9619
@pranavmittal9619 8 ай бұрын
sahi bol rahe maine toh 3 lakh mahine ka socha h package 25 students h mere college se 40+ lpa ke package wale 2024 me
@manasagarwal9341
@manasagarwal9341 3 ай бұрын
maza aagya bhaiya❣
@ParvezKhan-mj7yt
@ParvezKhan-mj7yt 3 күн бұрын
Thanks bro🙏🙏
@seekingsoul871
@seekingsoul871 8 ай бұрын
Bhaiya chamak gaya.
@ShivshankarKumaryadav-m4f
@ShivshankarKumaryadav-m4f 19 күн бұрын
1:08:02 tak bhaiya persent. atendance please😊😊
@itshirdeshk
@itshirdeshk 8 ай бұрын
Time and space complexity of last question: Time Complexity -> O(nlogk2) Space Complexity -> O(k1 + k2) -> O(k2), if you are using priority queue || O(1), if you are using step-down approach.
@sayanghosh2018
@sayanghosh2018 Ай бұрын
@be_a_DT
@be_a_DT 7 ай бұрын
Thank You Sir !
@abhinayjangde
@abhinayjangde 4 ай бұрын
1:06:25 Sum of elements between k1'th and k2'th smallest elements | Bhaiya Maine Aise banaya hai long long sumBetweenTwoKth( long long A[], long long N, long long K1, long long K2) { // Creating Min Heap priority_queue pq; for(int i=0; i
@Aniruddha_Mukherjee
@Aniruddha_Mukherjee 8 ай бұрын
Good morning Bhaiayaji 🥰🥰
@CoderArmy9
@CoderArmy9 8 ай бұрын
Good Morning Boss
@AnkushKumar-kv7zm
@AnkushKumar-kv7zm 7 ай бұрын
chamak gya bhaiya
@saumyachauhan174
@saumyachauhan174 6 ай бұрын
by approach of quick select: class Solution { public: int findKthLargest(vector& nums, int k) { int left = 0, right = nums.size() - 1, kth; while (true) { int idx = partition(nums, left, right); if (idx == k - 1) { kth = nums[idx]; break; } if (idx < k - 1) { left = idx + 1; } else { right = idx - 1; } } return kth; } private: int partition(vector& nums, int left, int right) { int pivot = nums[left], l = left + 1, r = right; while (l pivot) { swap(nums[l++], nums[r--]); } if (nums[l] >= pivot) { l++; } if (nums[r]
@techmjo2007
@techmjo2007 8 ай бұрын
Bhaiya Hashing Playlist wali Video kb Aayengi ???
@mohit6215
@mohit6215 8 ай бұрын
Waiting for baap playlist of Hashmaps
@vinodbarti9237
@vinodbarti9237 7 ай бұрын
thnks bhaiya 😄
@sayyedtaimoorshah6345
@sayyedtaimoorshah6345 8 ай бұрын
damaka daar
@sabhyaa
@sabhyaa 6 ай бұрын
best!
@Ajkr2
@Ajkr2 6 ай бұрын
bhaiya you r god
@VinuSawant-z1k
@VinuSawant-z1k 8 ай бұрын
Bhaiya App Dsa Series Puri Complete Karva Doge Na😅❤️
@ahmadjawwad3983
@ahmadjawwad3983 4 ай бұрын
love u bhai apka
@surajadhikari.
@surajadhikari. 2 ай бұрын
Present till end bhaiya
@nakulparmar126
@nakulparmar126 6 күн бұрын
✨✅📈
@AMANKUMAR-rz3fu
@AMANKUMAR-rz3fu 2 ай бұрын
Ok bhaiya
@akshaythakur4231
@akshaythakur4231 17 сағат бұрын
Last tak❤
@ChandanKumar-rv5xw
@ChandanKumar-rv5xw 2 күн бұрын
🔥🔥
@gajendrasinghdhaked
@gajendrasinghdhaked 5 ай бұрын
🤩
@PradeepKumar-bc1ez
@PradeepKumar-bc1ez 4 ай бұрын
Mja aaya
@Harshmishra0007
@Harshmishra0007 8 ай бұрын
Ram Ram bahi❤
@arunfrancis5921
@arunfrancis5921 8 ай бұрын
I don't want to normalise the 3lpa package in this industry 😻😻
@akashkewat1219
@akashkewat1219 8 ай бұрын
Done bhaiya.
@ParvezKhan-mj7yt
@ParvezKhan-mj7yt 3 күн бұрын
Bro thanks
@Noobiee_FPS
@Noobiee_FPS 8 ай бұрын
last tak dekha bhaiya
@Sanataniblood-mb5pu
@Sanataniblood-mb5pu 5 ай бұрын
❤❤❤❤❤
@ks.letsstartstudy.3994
@ks.letsstartstudy.3994 Ай бұрын
last tak😊
@machinecode2.047
@machinecode2.047 8 ай бұрын
Good morning sir
@YashSaini007
@YashSaini007 8 ай бұрын
Bhaiya Radhe Radhe 🙏
@CoderArmy9
@CoderArmy9 8 ай бұрын
Radhe Radhe bhai
@dealseasy363
@dealseasy363 8 ай бұрын
Till the End
@datarobo1718
@datarobo1718 5 ай бұрын
class Solution { public: vector kthLargest(int k, int arr[], int n) { // code here vectorans(k-1,-1); priority_queuep; for(int i=0;ik){ if(p.top()
@Unifyall
@Unifyall 2 ай бұрын
last tak😀
@secretbhiya6176
@secretbhiya6176 8 ай бұрын
Bhiya Course main new aaya hoon mujhe pata nhi chal rha main coder's army start kahan se kroon koi syllabus ya topic based hai kya jhan se main iss sare lecture ko start krron
@SajjalFatima-yt6oq
@SajjalFatima-yt6oq 2 ай бұрын
Roadmap Time and space complexity for Data structure and algorithm. Arrays linkedList stack queues Hash tables or HashMaps Recursion (tail non tail) Tower of hanoi problem binary trees binary search trees Heaps Sorting algos including Merge Sort, Quick Sort, Heapsort graphs DFS BFS MST Djisktra shortest path algo Floyd warshall algo Now some advance and optional topics AVL trees B trees 2 3 trees Fibonacci heaps N heaps or n children heaps. Kruskals Union find for MST Strongly Connected components algo Directed Acyclic Graphs.
@SajjalFatima-yt6oq
@SajjalFatima-yt6oq 2 ай бұрын
Follow this roadmap and watch the playlists of these topics one by one
@ritwiksaha2009
@ritwiksaha2009 6 ай бұрын
//Kth largest element in a stream vector kthLargest(int k, int arr[], int n) { vectorans(n); //this will store the answer //initialize ans with -1 for(int i=0; i
@nepalihoni9213
@nepalihoni9213 5 ай бұрын
opop
@RanjeetKumarceb
@RanjeetKumarceb 8 ай бұрын
Last tak chamak gaya
@yashnatholia2332
@yashnatholia2332 8 ай бұрын
🙏🙏🙏
@anuragrajput4613
@anuragrajput4613 8 ай бұрын
Bhaiya guide kardo or kya karna he agae
@Ajay-ie4mr
@Ajay-ie4mr 8 ай бұрын
last Tak
@shubhamkumarjha9192
@shubhamkumarjha9192 8 ай бұрын
Good morning bhaiya ji
@CoderArmy9
@CoderArmy9 8 ай бұрын
Good Morning Boss
@shrishtdev9961
@shrishtdev9961 8 ай бұрын
bhaiya mai hmesa nya hi sikhta huu
@vaishalichoudhary5
@vaishalichoudhary5 8 ай бұрын
Kth smallest Element using QUICK SELECT:) AVERAGE CASE T.C=O(KN) WORST CASE T.C=O(N^2) class Solution{ public: // arr : given array // l : starting index of the array i.e 0 // r : ending index of the array i.e size-1 // k : find kth smallest element and return using this function int calpivot(int arr[],int s,int e,int k){ int pos=s; for(int i=s;i
@animani5421
@animani5421 8 ай бұрын
Good morning bhaiya
@CoderArmy9
@CoderArmy9 8 ай бұрын
Good Morning Boss
@itshirdeshk
@itshirdeshk 8 ай бұрын
Day 188 ✅🔥
Beat Ronaldo, Win $1,000,000
22:45
MrBeast
Рет қаралды 158 МЛН
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН
She made herself an ear of corn from his marmalade candies🌽🌽🌽
00:38
Valja & Maxim Family
Рет қаралды 18 МЛН
Kth Largest Element in an Array - Leetcode 215 - Heaps (Python)
11:52
Priority Queue Explained | Min and Max Heap | Custom Comparator
23:19
Daily Code Buffer
Рет қаралды 23 М.
Introduction To Dynamic Programming
1:05:12
Coder Army
Рет қаралды 14 М.
BS-6. Minimum in Rotated Sorted Array
17:08
take U forward
Рет қаралды 202 М.
Kth Largest Element in an Array | Leetcode 215 | Heaps
17:43
Ayushi Sharma
Рет қаралды 12 М.
Arpit Bhayani talks about real engineering for 1 hour straight
1:16:23
Beat Ronaldo, Win $1,000,000
22:45
MrBeast
Рет қаралды 158 МЛН