# Tag Archives: Algorithms-Greedy Algorithms

## Maximize the sum of X+Y elements by picking X and Y elements from 1st and 2nd array

Given two arrays of size N, and two numbers X and Y, the task is to maximize the sum by considering the below points: Pick… Read More »

## Sudo Placement[1.3] | Playing with Stacks

You are given 3 stacks, A(Input Stack), B(Auxiliary Stack) and C(Output Stack). Initially stack A contains numbers from 1 to N, you need to transfer… Read More »

## Top 10 algorithms in Interview Questions | Set 2

In the previous post, top 10 algorithms/questions on different topics that are most asked in interviews is discussed. In this post, top 10 problems on… Read More »

## Minimum number of mails required to distribute all the questions

Given N questions in a test and K students in the class. Out of the batch of K students, N students memorised exactly one question… Read More »

## Minimum steps in which N can be obtained using addition or subtraction at every step

Given N, print the sequence of a minimum number of steps in which N can be obtained starting from 0 using addition or subtraction of… Read More »

## Minimum cost to process m tasks where switching costs

There are n cores of processor. Each core can process a task at a time. Different cores can process different tasks simultaneously without affecting others.… Read More »

## Algorithms | Greedy Algorithms | Question 6

Which of the following is true about Huffman Coding. (A) Huffman coding may become lossy in some cases (B) Huffman Codes may not be optimal… Read More »

## Algorithms | Greedy Algorithms | Question 5

Which of the following is true about Kruskal and Prim MST algorithms? Assume that Prim is implemented for adjacency list representation using Binary Heap and… Read More »

## Algorithms | Greedy Algorithms | Question 4

In question #2, which of the following represents the word “dead”? (A) 1011111100101 (B) 0100000011010 (C) Both A and B (D) None of these Answer:… Read More »

## Algorithms | Greedy Algorithms | Question 3

What is the time complexity of Huffman Coding? (A) O(N) (B) O(NlogN) (C) O(N(logN)^2) (D) O(N^2) Answer: (B) Explanation: O(nlogn) where n is the number… Read More »

## Algorithms | Greedy Algorithms | Question 3

A networking company uses a compression technique to encode the message before transmitting over the network. Suppose the message contains the following characters with their… Read More »

## Algorithms | Greedy Algorithms | Question 7

Suppose we run Dijkstra’s single source shortest-path algorithm on the following edge weighted directed graph with vertex P as the source. In what order do… Read More »

## Algorithms | Greedy Algorithms | Question 1

Which of the following standard algorithms is not a Greedy algorithm? (A) Dijkstra’s shortest path algorithm (B) Prim’s algorithm (C) Kruskal algorithm (D) Huffman Coding… Read More »