Data Structures & AlgorithmsVery hardGATE CSE · Advanced
A cache with 3 slots serves the page requests 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5. How many misses occur under LRU replacement and under FIFO replacement?
- A. LRU 9, FIFO 10
- B. LRU 9, FIFO 9
- C. LRU 10, FIFO 9
- D. LRU 10, FIFO 10
Correct answer: C. LRU 10, FIFO 9
Simulating both policies gives 10 misses for LRU and 9 for FIFO on this particular sequence; LRU is not always better.
Practise more Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questionsArrays, Strings, Linked Lists, Stacks, Queues and Hashing: notes and key points
More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions
- What is the time complexity of reading the element arr[i] from an array of n elements, given i?
- Which data structure works on the Last In, First Out (LIFO) principle?
- What is the worst-case time complexity of binary search on a sorted array of n elements?
- Which of these sorting algorithms is stable in its standard implementation?
- What is the time complexity of inserting a new node at the head of a singly linked list of n nodes?
- With a good hash function and a bounded load factor, what is the average time to search for a key in a hash table?