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.
Standard Greedy Problems
The greedy algorithm is one of the most easy-to-understand algorithms. We have to choose the local best option and build up a solution. To get better practice, let us have a look at some standard greedy problems that are asked frequently.
Activity Selection problem and Greedy Algorithm
● Published At Oct 2021
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.... Keep reading ..
Job scheduling algorithm
By Malay Gain
● Published At Dec 2021
Huffman Encoding
● Published At Nov 2021
In this article, we will discuss the Huffman Encoding Algorithm, its uses, various application, and implementation.... Keep reading ..
Gas Station
By Shreya Deep
● Published At Oct 2021
In this article, we’ll learn how to solve a very famous problem, “gas station.”... Keep reading ..
Minimum Number of Platforms Required for a Railway/Bus Station
By aniket verma
● Published At Nov 2021
This article will brief you on finding the Minimum Number of Platforms Required for a Railway/Bus Station.... Keep reading ..
Merge Intervals
By Shreya Deep
● Published At Oct 2021
In this article, we’ll learn how to merge intervals to make them mutually exclusive.... Keep reading ..
Maximum Disjoint Intervals
By aniket verma
● Published At Oct 2021
Maximum number of overlapping intervals
By aniket verma
● Published At Oct 2021
Shortest Unsorted Continuous Subarray
By Ishita Chawla
● Published At Nov 2021
This blog will discuss three different approaches to find the length of the shortest unsorted continuous subarray. ... Keep reading ..
Queue Reconstruction by Height
By Pranav Gautam
● Published At Nov 2021
Learn to reconstruct a queue with given position preferences for each element of the queue.... Keep reading ..
Find maximum meetings in one room
By Yukti Kumari
● Published At Nov 2021
This article explains the solution to the problem of finding maximum meetings in one room when the start and end times of each meeting is given. ... Keep reading ..
Reduce array to a single element by repeatedly removing an element from any increasing pair
By Apoorv
● Published At Feb 2022
This article will discuss the solution of the problem “Reduce the array to a single non-zero element by repeatedly removing an element from any increasing pair” along with the time complexity and space complexity of the solution... Keep reading ..
Next Permutation
By Urwashi Priya
● Published At Oct 2021
This article will brief you on implementing the next permutation of a number. ... Keep reading ..
Minimize Cash Flow among a given set of friends who have borrowed money from each other
By Soumya Agrawal
● Published At Oct 2021
In this blog, we will be solving the problem of minimizing cash flow and the code. ... Keep reading ..
Divide 1 to n into two groups with a minimum sum difference
By GAZAL ARORA
● Published At Mar 2022
In this article, we will solve one of the most asked coding problems: divide 1 to n into two groups with a minimum sum difference.... Keep reading ..
Fractional Knapsack Problem
By Vaibhav Agarwal
● Published At Dec 2021
In this article, we will discuss the problem in which we are given weights and values of x items. We need to put them into a bag of capacity W and should get the maximum possible value.... Keep reading ..
The greedy algorithm is a very important topic when it comes to competitive programming and also for product-based companies. Introducing some variants to simple greedy algorithm questions can make them tricky. Let us have a look at some advanced greedy problems to get a good understanding of the topic.
Minimum initial vertices to traverse the whole matrix with given conditions
By Apoorv
● Published At Feb 2022
This article will discuss the solution to find Minimum initial vertices to traverse the whole matrix with given conditions. Along with the solution, the article focuses on the time and space complexity of the solution.... Keep reading ..
K Centers Problem
By GAZAL ARORA
● Published At Mar 2022
In this article, we will solve an NP-hard problem. One of the most important programming problems and a real-world application: The k centers Problem.... Keep reading ..
Shortest Superstring
By Rhythm Jain
● Published At Feb 2022
Minimum Number of Arrows to Burst Balloons
By Yukti Kumari
● Published At Oct 2021
This article explains how to solve the problem of finding the Minimum Number of Arrows to Burst Balloons.... Keep reading ..
Find Minimum Number of Arrows Needed to Burst all Balloons
By Riya
● Published At Feb 2022
This article will discuss the problem "Find the minimum number of arrows needed to burst all balloons," the solution approach to this problem, its C++ implementation, and its time and space complexity.... Keep reading ..
Equilibrium Point
By Urwashi Priya
● Published At Nov 2021
This article will brief you on how to find the equilibrium point of an array. ... Keep reading ..
Product of array except self
By Urwashi Priya
● Published At Oct 2021
This article will brief you on the problem “product of array except self”. ... Keep reading ..
Jump Game
By Sandeep kamila
● Published At Nov 2021
This blog will cover two different approaches to the problem Jump Game with an explanation and their C++ code.... Keep reading ..
Jump Game II
By Soumya Agrawal
● Published At Oct 2021
In this blog, we will build logic for the problem of minimum jumps and other problems related to this.... Keep reading ..
Boats to Save People
By Saksham Gupta
● Published At Dec 2021
In this blog, we will discuss one of the most asked questions in the greedy algorithm category, i.e., boats to save passengers. ... Keep reading ..
Get Equal Substrings Within Budget
By Ishita Chawla
● Published At Dec 2021
This blog will be discussing the problem Get Equal Substrings Within Budget along with its time and space complexity. ... Keep reading ..
Number of wonderful substrings
By Ayush Tiwari
● Published At Jan 2022
This blog finds the number of wonderful substrings in a given string.... Keep reading ..