Skip to content

Category Archives: Greedy

Given length of wall w and shelves of two lengths m and n, find the number of each type of shelf to be used and… Read More
Prerequisite : Page Replacement Algorithms In operating systems that use paging for memory management, page replacement algorithm are needed to decide which page needed to… Read More
Prerequisite: Page Replacement AlgorithmsIn operating systems that use paging for memory management, page replacement algorithm are needed to decide which page needed to be replaced… Read More
We have discussed Huffman Encoding in a previous post. In this post decoding is discussed. Examples:Attention reader! Don’t stop learning now. Get hold of all… Read More
In a candy store, there are N different types of candies available and the prices of all the N different types of candies are provided.… Read More
There are N Mice and N holes are placed in a straight line. Each hole can accommodate only 1 mouse. A mouse can stay at… Read More
Greedy is an algorithmic paradigm that builds up a solution piece by piece, always choosing the next piece that offers the most obvious and immediate… Read More
You are given a list of N coins of different denominations. You can pay an amount equivalent to any 1 coin and can acquire that… Read More
Given n objects, with each object has width wi. We need to arrange them in a pyramidal way such that :   Total width of ith… Read More
Given two arrays a[] and b[] of equal length n. The task is to pair each element of array a to an element in array… Read More
Given a string with repeated characters, the task is to rearrange characters in a string so that no two adjacent characters are same.Note : It… Read More
Given a permutation of first n natural numbers as array and an integer k. Print the lexicographically largest permutation after at most k swaps  Examples: Attention… Read More
Given an array of n elements. Consider array as circular array i.e element after an is a1. The task is to find maximum sum of… Read More
Prerequisite : Partition allocation methodsWorst Fit allocates a process to the partition which is largest sufficient among the freely available partitions available in the main… Read More
Prerequisite : Partition allocation methods Best fit allocates the process to a partition which is the smallest sufficient partition among the free available partitions. Attention… Read More