Master 30 Software Developer interview questions covering algorithms, system design, and coding challenges.
Question 6 of 30
How to Answer 1
How to Answer 2
Example Answer
Community Answers

Tom Dushaj is a business and technology executive and the author of 'Resumes That Work.' Tom has vast experience providing solutions to Fortune 500 companies in the areas of Information Technology Consulting, ERP Software, Personnel Management, and Intern
When I start a development project, I always approach it by developing a program or application with a result in mind. One question that I always ask is.......what does the user intend to get out of the program or application. There are many approaches I can take, but a common one that I find to be most efficient when implementing an LRU Cache is when I use two data structures. They are Queue and A Hash. To provide a fast and easy way of retrieving data, it must meet certain requirements. Here are some of the requirements that need to be met:
Fixed Size: The Cache needs to have some boundaries to limit memory usage.
Fast Access: The Cache Insert and lookup operation should be fast, preferably at an O(1) time.
Replacement of Entry: In case of memory limit is reached. A cache should have an efficient algorithm to evict an entry when the memory is full.

Tom Dushaj is a business and technology executive and the author of 'Resumes That Work.' Tom has vast experience providing solutions to Fortune 500 companies in the areas of Information Technology Consulting, ERP Software, Personnel Management, and Intern
Having a favorite programming language tells a lot about the experience and expertise level of a software developer. There are numerous languages to pick from, and depending on what applications you are working on and what you intend to achieve, some might work better than others. A hiring manager might start with a question about your favorite language and then move to your approach and possibly your methodology or reasoning for favoring that language. Let me give an example of how this question might be answered. If we intend to use Java for this example, we would look at the LRU cache and recently used entries, then remove the element from the bottom and add an element to the start of a LinkedList. Wherever any entry is accessed, it is moved to the top so that recently used entries will reside at the top, and the least used entries will reside on the bottom.

Tom Dushaj is a business and technology executive and the author of 'Resumes That Work.' Tom has vast experience providing solutions to Fortune 500 companies in the areas of Information Technology Consulting, ERP Software, Personnel Management, and Intern
"The way I approach implementing an LRU Cache is really based on what programming language is used in the development environment. Yes, I do have a preference, but I consider it a tool in a toolbox. I use whatever is available to me. Java seems to be a tool of choice in most development environments, and for me as well. Say, for example, we are given total possible page numbers that can be referred. We are also given cache (or memory) size (Number of page frames that the cache can hold at a given time). The LRU caching scheme is intended to remove the least recently used frame when the cache is full, and thus a new page is referenced which was not in the cache before. Examples of this approach and method are referenced in the Galvin book."

Interview Coach
Jaymie
A real coach, not AI. I read every answer myself and write back with personalized feedback.
Typically responds within 24 hours.
0 - Character Count
Unlock expert responses to technical and behavioral questions interviewers ask developers.
Get StartedJump to Question

Written by Tom Dushaj
30 Questions & Answers • Software Developer

By Tom

By Tom