Implement LRU Cache | C++ and Java Clean and Short Implementation

preview_player
Показать описание

In case you are thinking to buy courses, please check below:

Watch at 1.25x for better experience ..
---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------

#dsa​ #striver #leetcode
Рекомендации по теме
Комментарии
Автор

If you are coming from watching the previous video explanation, do comment

takeUforward
Автор

Couldn't get a better explanation than this. Thanks bhaiya.
You are doing a great job helping us.
Expecting more such explanatory videos

AdityaSoni-swfc
Автор

We can free memory by delete or free operation on the LRU node which is to be deleted when put is performed when cache size is exceeded.

mynkprtp
Автор

Is it necessary to erase key from map which is already present? I think that will automatically be overwritten when we assign new value to the key

kumarivandana
Автор

Can you make a series for dp????
You as a teacher is really awesome, can connect with you.

techzone
Автор

Striver Sir, Knowledge Gate's lectures are no more free, the playlist on YouTube has private videos, I request to please tell the alternative for learning OS DBMS CN for SDE interview. Should I go for GFG's CS Fundamentals?
Thank You.

akshatgupta
Автор

Thank you so much! Your explanations are always top notch!

doingsneakypeakylike
Автор

In your SDE sheet, why is this llisted under Stacks and Queues even though stack or
queue is not used here..?

kushalappaca
Автор

I didn't think I'll wait for this question this long. Gr8 explanation 🔥🔥

The_Gurugram_Voyager
Автор

Can somebody please clear my doubt?

The deletenode call inside get method is only breaking the link for resnode, and we are assigning the same node after head in addnode call, so why are we updating the corresponding address in the map?

I think there is no neee to write
m[key_] = head->next;

Xp-Sam
Автор

Aditya bhai, isse acha explanation and code kahi aur nahi mila, Thanks!!!

Spider-Man_
Автор

Great teaching, you makes everything clear, without diving into code.
one suggestion : you should free up space of node which is deleted in dll.

RahulSingh-detb
Автор

Why not use list STL instead of implementing doubly linked list by yourself?

afrahriyaz
Автор

Awesome explanation!!
Thank you for your efforts 💝

pabitrakb
Автор

Why are we storing key in the linkedlist node ? only storing value will be enough right as we have key in hashmap. Is there any significance of it ?

subhasishdas
Автор

You have a course on GFG ? Can you provide details or the link?

mohithguptakorangi
Автор

head->next = tail;
tail->prev = head;
Why is this written inside LRUCache(){} ?
It shows error when written right after head and tail are both initialized. Why?
Please explain someone🙏

tejasu
Автор

Can we take priority queue of linked list to solve this ?

decostarkumar
Автор

Couldn't get a better explanation than this.

neetisaharan
Автор

DUDEEE!
It got accepted, and the explanation is sooo simple too.

sankalpietechtips