Sliding Window Maximum | Sliding Window Algorithm | Deque Data Structure | DSA-One Course #54
Vložit
- čas přidán 27. 07. 2024
- Hey guys, In this video, We're going to solve another very famous Interview Problem called - Sliding Window Maximum
0:00 Problem statement
1:41 Naive Solution
2:31 Naive Solution code
3:26 Using AVL tree/Max Heap
6:51 Using Max heap code
8:23 Using Deque
15:06 Using Deque code
code: www.geeksforgeeks.org/sliding...
🥳 Join our Telegram Community:
Telegram channel: telegram.me/realanujbhaiya
Telegram group: telegram.me/dsa_one
🚀 Follow me on:
Instagram: / anuj.kumar.sharma
Linkedin: / sharma-kumar-anuj
Twitter: / realanujbhaiya
💸 Use coupon code ANUJBHAIYA on GeeksforGeeks to avail discounts on courses!
📚 Complete DSA Playlist: • DSA-One Course - The C...
Complete Android Development Playlist: • Android Development Tu...
Hashtags:
#anujbhaiya #dsaone
Tags:
sliding window maximum
sliding window algorithm
sliding window
maximum of all subarrays of size k
sliding window problem
sliding window technique algorithm
anuj bhaiya
sliding window technique
sliding window java
239. sliding window maximum
sliding window dsa
sliding window c++
maximum of minimum for every window size
first negative integer in every window of size k
sliding window playlist
deque
sliding window maximum leetcode
sliding windows
sliding window problems
window sliding technique
maximum sliding window
sliding window max
sliding window python
sliding window in java
window sliding
dequeue in data structure
find the maximum of minimums of every window size
leetcode 239
deque data structure
dsa
monotonic queue
sliding window concept
sliding window leetcode
anuj bhaiya dsa
anuj bhaiya java
sliding window approach
sliding window maximum (maximum of all subarrays of size k)
sliding window median
java+dsa
sliding window coding
sliding window javascript
sliding window protocol
smallest distinct window
apna college
dequeue in java
double ended queue
dsa one
maximum erasure value
maximum subarray problem
maximum sum subarray of size k
minimize the maximum difference between the heights
sidemen spend
sliding
sliding window code
sliding window pattern
sliding window questions
i never go without liking your video. i don't know why people even can't do this for you when they take huge knowledge for free. people should respect the effort.
i also try to let run ads completely whenever i can so that you can get some benefit. this is the least that we can do while watching your videos...
Congratulations bhaiya for 200k family.🥳🎉🎉🎉🎉🎉🎉🎉❣️ waiting for 1 million 🥺
thank you 🥰
Welcome bhaiya🎉🥳🤩❣️@Anuj Bhaiya
I always takes very deep interest in your videos because your explanation is very simple for understanding sir ❤️❤️
Best way of explaining DSA question. your videos are amazing
I have seen many youtuber teachers , but this way of explaination and sense of logic satisfation only coming with ANUJ BHAIYA..
Thanks A LOT.....
q jhooth bol rha hai bhai
@@AmanKumarSINGH-dj5sk Bro, I find his way of explaination very helpful, because his explanation is very simple for understanding, in my case.
You might need to explore more !
Crystal Clear Explaination
Bhaiya Thanks for this course!
Bhai ye to interview material hai ... Coding Ninja k paise bacch gaye. Grateful for the work you are putting out there.
Pure Nice explanation....
Thanks bro awesome explanation.
Its very important problem . It is used in another Q as a part. Try to memorize and practice O(n) approach.
Great Tutorial Bhaiya
Congrats for 200k, love from🇧🇩
many many congratulation anuj sir
Congrats Anuj Bhaiya for 200k subscribers 🎊🎊. And Thank you I have recently secured a job with the help of your Java course at Apni kaksha and DSA One Course 🙏❤️❤️
400k ho gye Bhai 💥
Congratulations bhaiya for 200k 🎉🎉
This video helped a lot
Congratulations bhaiya 200k more to go 😁 btw bhut helpful video ❤❤
thank you 🥰
Thank you 😌
Nice Explanation Sir
Useful ❤️🙏
CONGRATULATIONS BHAIYA FOR 300 K👍👍❤
Congratulations on 200k subscribers.
Thanks 👍
very helpful bhaiya
Congratulations Bhai.. For 200k.❤
Cant code the second solution in CPP, there is no function to pop elements with value, we can only pop the min or max element from 2 types of priority queues.
If there is any code of second approach in c++ kindly help.
I have the same doubt. Lets say even if it is there, then it is not a question of heap exactly.
Hello Anuj Bhaiya , I want to buy you an coffee! thanks for the videos
Congratulations bhaiya for 200k subscriber. I have one question
Bhaiya agar kisi k paas software engineer ki degree nhi ho aur wo agar skill ke base pr kisi startup ya kisi choti company mein sde-1 ki job kr leta hai to kya iske base pr usey Google Microsoft ya Amazon mein job mil skti hai.
Please reply
You could also solve this using segment trees, for the people who ain't aware of deque ds
this video is helpful
In 2nd approach, In C++, we can't delete given value in heap 🙄
yes, you cannot delete a value from a heap, what you have to do is, store a vector, with value and index, and check whether the index of the element at the top of heap, is inside of the window or not, if not, then you need to pop it
congrats on 400k anuj bro
Random deletion of element in priority queue is possible in cpp.
If yes, how ?
that's also my question
bhaiya add more video's frequently and u told that u add one video per day, try to make that.....
why there is no .remove() function for the priority queue in the c++?
Same happened with me, have you solved it by heap?
deleting an arbitrary element from the heap takes more than logarithmic time
bhai bhaari sikhate ho aap
Isn’t random element deletion in priority queue a O(n) operation? how can time complexity of 2nd solution be O(n log k) then
Having the same doubt, for root element deletion takes O(log N) how will it be same for any other random element. One needs to iterate all k elements to get the one that needs to be deleted.
@@ankurssharma96 ++
2nd solution ie remove(object) in priority queue is O(N). The time complexity is quadratic and gives TLE . I have tried the code..
O(logn) for tree.
There is no function to remove elements other than top in priority queue
Deletion of a random element from the heap takes O(n) time, right?
How can it be O(log n)?
Max heap h
@@psycho_gaming2422 bhai random element bol raha hai wo, random kaise search kar lega koi BST thode hi hai ye.
nice
How to think of edge cases in programming? I really suck at this!
Add videos on graph data structure🙏🙏
Bhai Doubly linked list ka create, insert,delete,display ka ek video bana do please🙏
I am waiting for 500K!
hum first
Deque solution taking O(n*k) because for every element we are checking is there any smaller element then that so it take O(n*k) right?.....Please Anuj Bhaiya Clarify!!!!
sir aapne bola ki useful element vo hoge jiske left me uss se chote element nahi hoge...so in case of 2 3 2 only 3 should be useful element?
we can use multiset as well right ?
PriorityQueue solution is not NlogK.. It is NK ie quadratic..This solution gives TLE
in AVL tree or in the deque approach - once we computed max for 1st window why then in next for loop we again start from I=0 ?? 1st window is already done start from I=k
Third 🤭
bhaiya priority_queue se toh iska output galat ayega
Second🤭
deque approch : in increasing order, its complexity becomes (n+k) again
fist like
🤣 0:26 Dunda 🤣
😛
Qi.peek()
Next video kab ayega?
Can you pls tell me what is the initial value of i in 2nd loop
k
bhaiya kab tak finish hojayega ye course
Abe yaar ye i-k waala concept samajh nhi aa rha Deque waali approach me
Bhaiya pls tell why we are writing dq.front()
Why are we adding index's ?
Pls add subtitles
200K
Anyone doing the code in python???
*Keya sir ??? AAP SILF ENGINEERS / BCA / MCA logo ke liye video banate ho ?? Hum non-IT wale jo students IT mei passionate hai....unlogo ke liye nhi banate ho 😔😔.*
*Aise bohot talented students hai jo IT mei jana chahta hai but paise ka kami ke wajay se IT degree (**B.tech/** BCA / MCA ) nhi kar paye. But the sad reality is no SO CALLED BIG CZcamsR talks about us.*
Congratulations bhiayaaaaaa... Keep going... Thankyou for all this videos bhaiya...
Please do accept my message request on Instagram I needed to talk to you..