Implement LRU cache

preview_player
Показать описание
This video shows how to implement LRU cache in the most efficient way. This explanation involves step by step optimization explanation with proper examples. We can implement LRU cache in just O(1) time for each query. As usual the CODE LINK is present below. If you find any difficulty or have any query then do COMMENT below. PLEASE help our channel by SUBSCRIBING and LIKE our video if you found it helpful...CYA :)

Рекомендации по теме
Комментарии
Автор

my CS degree < Tech Dose Content. Keep making sir. I love the content and easy to understand the concepts.

ajutamang
Автор

2 mins into the video, I already know the DS and Algo to be used. Amazing video!

pratikjain
Автор

Bravo once again, I never got a CS degree so I missed out on a lot. your videos are a blessing!

marhawk
Автор

actually u r pretty gr8 to be a teacher...absolutely amazing

idgaf
Автор

Please correct me if i am wrong,
Considering n=cache size and q=query size
Even in hash approach the case where there is a page hit to remove the hitted node and keep it at the rear position it takes O(n), so for shifting in this case it takes O(n) and searching O(1) so considering time complexity is calculated referring to worst time complexity, it takes O(n*q) time complexity even using the hash approach 😅

saikrishnamohith
Автор

I like the approach presented to arrive at the final solution - thank you for making this video.

SatishKumar-jbqm
Автор

I've been searching for this everywhere, and the explanation was hats off man

hariprasadcr
Автор

I love your way of teaching. Made all my doubts clear.

piyushagarwal
Автор

Instead of HashMap we can use Set to store current elements keep updating that on any change with O(1). Searching would also be O(1).

hangoutwithabhi
Автор

Approach is good sir.
Writing code in DLL will be lengthy & more difficulty in handling boundary cases.Instead we can use queue, code will be very compact & easy to handle.
Sir please also make videos on DP question.

najimali
Автор

Compare to other channel techdose is underrated...It never happens that i watched your video and feel like wasted time..u are awesome.

yasvidobariya
Автор

This is gold. Thank you very much for this.

GauravSingh-boys
Автор

awesome explanation. Thank you, sir, felt like remembered OS class in college, of course, this is better than that

sureshgarine
Автор

Thank you so much for such a wonderful explanation

hackytech
Автор

Nice but I believe u missed the last part in which we have to shift the requested page to the rightmost if gets found in cache

aneksingh
Автор

Knowledge sharing was good in session. Thanks

akshay_g
Автор

Brilliant video. Loved the way you explained optimisation stepwise. Thanks. Also, no unnecessary comments. Strictly content.

randomcommentor
Автор

The way u explained... It's brilliant.
But i have 2 doubts
1. Hash table size is, random or equal to window size and how to handle collision?
2. What r it's real world implications ?

Rajesh-rgfw
Автор

thanks for showing how to optimize step by step

ss-xhhf
Автор

Sir can we use circular queue to reduce shifting since the insertion is always done at rear and deletion will be always done from front. also the time taken for both the operation will be 1

meghendrasharma