Last updated: Aug 2, 2022

Greedy Algorithms

As the name implies, a greedy technique always chooses the option that appears to be the best at the time. This means it will make a locally optimal decision to arrive at a globally optimal solution. For example, if you want to travel from point A to point B, there are numerous options, such as walking, cycling, car, air, etc. However, if you need to arrive in the shortest amount of time, you'll estimate the time from all possible options and then choose wisely which will be the most efficient. You must compare the current option with the previous option to select the optimal solution. This is referred to as the greedy technique. In computer science, we frequently employ greedy techniques. This category revolves around greedy techniques and uses them in solving optimization problems.
Activity Selection problem and Greedy Algorithm
This blog discusses the solution to the activity selection problem using a greedy algorithm. Read to learn different cases of the problem and the solution.
Job scheduling algorithm MEDIUM
In this article, we discuss one of the common problems involving Job Scheduling and its solution - Job Scheduling Algorithm along with its implementation in C++.
Boruvka's Algorithm MEDIUM
This blog helps you clear your understanding of Boruvka's Algorithm and dry run with various examples to have a clear idea.
Minimum Number of Platforms Required for a Railway/Bus Station
This article will brief you on finding the Minimum Number of Platforms Required for a Railway/Bus Station.
Shortest Unsorted Continuous Subarray
This blog will discuss three different approaches to find the length of the shortest unsorted continuous subarray.
Queue Reconstruction by Height
Learn to reconstruct a queue with given position preferences for each element of the queue.
Find Maximum Meetings in One Room MEDIUM
Find the maximum number of meetings in one room using greedy approach. This article explains the greedy approach to solve the n meeting in one room problem and provides C++, Java, and Python implementations.
Finding Kth Largest Number in a Given Array of Large Numbers
In this blog, we will learn to solve a problem based on sorting. We will discuss the approach based on the overloading of the comparator function.
Find the smallest range containing at least 1 element from given N ranges.
This article will brief you on how to Find the smallest range containing at least 1 element from given N ranges.
Find a minimum number of bins to place N items(using the best-fit algorithm) EASY
In this article, we will discuss the problem of finding a minimum number of bins to place N items(using the best-fit algorithm).
Minimize the sum of minimum and second minimum elements from all possible triplets
This article covers the approach to minimize the sum of minimum and second minimum elements from all possible triplets with its C++ code.
Author Spider
0 upvotes
Minimize the Sum of Minimum and Second Minimum Elements from All Possible Triplets
In this blog, we will discuss a classical problem of the greedy Algorithm and a famous interview question, i.e., minimize the sum of minimum and second minimum elements from all possible triplets.
Minimize Deletions from Either End to Remove Minimum and Maximum from Array
The task is to find the minimum number of deletions from start or end to remove minimum and maximum elements of the array.
Greedy Algorithm in Graph Theory EASY
In this article, we will discuss greedy algorithm in detail.
Maximize cost obtained by removal of substrings “pr” or “rp” from a given String
This article discusses maximizing the by removing the substring "pr" or "rp" from a given string.
Minimize insertions or deletions to make the frequency of each array element equal to its value
This blog discusses a coding challenge based on greedy algorithms. Greedy algorithms are one of the most asked topics in technical interviews and programming contests.
Maximize score by rearranging Array such that absolute difference of first and last element is minimum
In this blog, we will discuss a coding challenge that involves the use of sorting and greedy algorithms. Greedy algorithms are well known for their simplicity and ease to understand.
Minimize Swaps to Make Remainder Equal When an Element and its Index is Divided by K
The task is to find minimum swaps required to make every element’s remainder with k equal to its index remainder with k.
Minimize Flips to Make the Binary String as all 1s by Flipping Characters in a Substring of size K Repeatedly MEDIUM
In this blog, we will take up a coding problem based on strings. We will learn to use a greedy approach to solve the challenge.
Dial's Algorithm HARD
This blog explains what Dial's algorithm is and in which cases it is useful. We also see its logic, working and implementation in code.