Huffman Encoding is an important topic from GATE point of view and different types of questions are asked from this topic. Before understanding this article,… Read More

# Category Archives: Greedy

Minimum spanning Tree (MST) is an important topic for GATE. Therefore, we will discuss how to solve different types of questions based on MST. Before… Read More

There are n students in a class, each in possession of a different funny story. As the students were getting bored in the class, they… Read More

Every house in the colony has at most one pipe going into it and at most one pipe going out of it. Tanks and taps… Read More

Find the smallest number such that the sum of its digits is N and it is divisible by . Examples : Input : N =… Read More

Given a positive integer n such that n > 2. Divide numbers from 1 to n in two groups such that absolute difference of sum… Read More

Given a string S, change the smallest number of letters in S such that all adjacent characters are different. Print the resultant string. Examples :… Read More

A new variety of rice has been brought in supermarket and being available for the first time, the quantity of this rice is limited. Each… Read More

Given an array of n integers. We need to reduce size of array to one. We are allowed to select a pair of integers and… Read More

Given an amount, find the minimum number of notes of different denominations that sum upto the given amount. Starting from the highest denomination note, try… Read More

Given an array of non-negative integers. Our task is to find minimum number of elements such that their sum should be greater than the sum… Read More

We have discussed one loss minimization strategy before: Job Sequencing Problem – Loss Minimization. In this article, we will look at another strategy that applies… Read More

Given the length, breadth, height of a cuboid. The task is to divide the given cuboid in minimum number of cubes such that size of… Read More

We are given a matrix that contains different values in its each cell. Our aim is to find the minimal set of positions in the… Read More