We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Abstract Classes - Polymorphism
Abstract Classes - Polymorphism
Sort by
recency
|
338 Discussions
|
Please Login in order to post a comment
This was a great exercise to understand how abstract classes and polymorphism work in C++. Cricbet99 club register
Thiiiis feels like a poorly-designed problem. In addition to the lack of polymorphism mentioned in the top voted comment, the question presents the cache as a way to avoid doing expensive lookups, which, okay, a linked list is expensive to sort through. But then, it provides you a std::map mp, which lets you look up nodes quickly anyways?
std::map can't be used for implementing LRU as-is since it doesn't store any information about recency, unless I'm missing something? It's not clear from the description, either:
"mp - Map the key to the node in the linked list"
That's a request, not a description.
This challenge is a great way to understand how abstract classes and polymorphism work in object-oriented programming. 11xplay
Here is my simple implementation. Using sentinel nodes.
they are essential for designing clean, modular, and maintainable object-oriented code. गोल्ड 365 विन लॉगिन