Posts

The least recently used (LRU) cache algorithm exists the element from the cache(when it’s full) that was least recently used. After an element is requested from the cache, it should be added to the cache (if not already there) and considered the most recently used element in the cache. Initially, the cache is empty. The input to the function LruCountMiss shall consist of an integer max_cache_size, an array pages and its length Len The function should return an integer for the number of cache misses using the LRU cache algorithm. Assume that the array pages always have pages numbered from 1 to 50.

Mooshak the mouse has been placed in a maze. There is a huge chunk of cheese somewhere in the maze. The maze is represented as a two-dimensional array of integers, where 0 represents walls.1 represents paths where Mooshak can move and 9 represents the huge chunk of cheese. Mooshak starts in the top left corner at 0. Write a method is Path of class Maze Path to determine if Mooshak can reach the huge chunk of cheese. The input to is Path consists of a two dimensional array and for the maze matrix. The method should return 1 if there is a path from Mooshak to the cheese. And 0 if not Mooshak is not allowed to leave the maze or climb on walls.

There is a colony of 8 cells arranged in a straight line where each day every cell competes with its adjacent cells (neighbour). Each day, for each cell, if its neighbours are both active and both inactive, the cell becomes inactive the next day, otherwise it becomes active the next day. Assumptions: The two cells on the ends have single adjacent cell, so the other adjacent cell can be assumed to be always inactive. Even after updating the cell state. Consider its previous state for updating the state of other cells. Update the cell information of all cells simultaneously. Write a function cell Compete which takes one 8 element array of integer’s cells representing the current state of 8 cells and one integer days representing the number of days to simulate. An integer value of 1 represents an active cell and value of 0 represents an inactive cell. Existing Program int* cellCompete(int* cells,int days) {/ /write your code here } //function signature ends

Most Frequent character

Area of ellipse #include using namespace std; // Function to find area of an // ellipse. void findArea( float a, float b) { float Area; // formula to find the area // of an Ellipse. Area = 3.142 * a * b ; // Display the result cout << "Area: " << Area; } // Driver code int main() { float a = 5, b = 4; findArea(a, b); return 0;