## Prim’s MST for Adjacency List Representation | Greedy Algo-6

We recommend to read following two posts as a prerequisite of this post. 1. Greedy Algorithms | Set 5 (Prim’s Minimum Spanning Tree (MST)) 2.… Read More »

- Split the given array into K sub-arrays such that maximum sum of all sub arrays is minimum
- Find maximum meetings in one room
- Largest substring with same Characters
- Find minimum changes required in an array for it to contain k distinct elements
- Maximum Length Chain of Pairs | Set-2
- Unbounded Fractional Knapsack
- Count of integers that divide all the elements of the given array
- Create a Sorted Array Using Binary Search
- Find minimum length sub-array which has given sub-sequence in it
- Count common elements in two arrays containing multiples of N and M
- Maximum String Partition
- Minimum deletions required to make GCD of the array equal to 1
- Minimum operations required to make every element greater than or equal to K
- Number of balanced parenthesis substrings
- Find the Kth smallest element in the sorted generated array
- Minimum deletions required such that any number X will occur exactly X times
- Longest Subarray having strictly positive XOR
- Fractional Knapsack Queries
- Count ways to divide circle using N non-intersecting chord | Set-2
- Find if a binary matrix exists with given row and column sums
- Minimum deletions required to make frequency of each letter unique
- Lexicographically smallest string of length N and sum K
- Minimum increment operations to make K elements equal
- Find Nth smallest number that is divisible by 100 exactly K times
- Queries for number of distinct elements from a given index till last index in an array
- Check if string can be rearranged so that every Odd length Substring is Palindrome
- Order of indices which is lexicographically smallest and sum of elements is <= X
- Find optimal weights which can be used to weigh all the weights in the range [1, X]
- Count total number of even sum sequences
- Minimum cost to convert str1 to str2 with the given operations

We recommend to read following two posts as a prerequisite of this post. 1. Greedy Algorithms | Set 5 (Prim’s Minimum Spanning Tree (MST)) 2.… Read More »

We have discussed Kruskal’s algorithm for Minimum Spanning Tree. Like Kruskal’s algorithm, Prim’s algorithm is also a Greedy algorithm. It starts with an empty spanning tree. The… Read More »

We recommend to read following post as a prerequisite for this. Greedy Algorithms | Set 3 (Huffman Coding) Time complexity of the algorithm discussed in… Read More »

What is Minimum Spanning Tree? Given a connected and undirected graph, a spanning tree of that graph is a subgraph that is a tree and… Read More »

You are given n pairs of numbers. In every pair, the first number is always smaller than the second number. A pair (c, d) can… 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 »

Given a value N, if we want to make change for N cents, and we have infinite supply of each of S = { S1,… Read More »

Following two algorithms are generally taught for Minimum Spanning Tree (MST) problem. Prim’s algorithm Kruskal’s algorithm There is a third algorithm called Boruvka’s algorithm for… Read More »

Minimum Spanning Tree (MST) problem: Given connected graph G with positive edge weights, find a min weight set of edges that connects all of the… Read More »

Write a function rotate(ar[], d, n) that rotates arr[] of size n by d elements. Rotation of the above array by 2 will make array… Read More »

A permutation, also called an “arrangement number” or “order,” is a rearrangement of the elements of an ordered list S into a one-to-one correspondence with… Read More »