![]() For this we will take under consideration all the valid coins or notes i.e. In this problem, we will use a greedy algorithm to find the minimum number of coins/ notes that could makeup to the given sum. Repeat step 1 and step 2 till we left with single value in the list and that will be root node of newly constructed. ![]() Remove both value and insert new value in the list while maintaining the order. greedy algorithm works by finding locally optimal solutions ( optimal solution for a part of the problem) of each part so show the Global optimal solution could be found. Find out minimum value from the list and compare it with its neighbour to get minimum product ( a non-leaf node ). A greedy algorithm is an algorithm used to find an optimal solution for the given problem. This means that it makes a locally-optimal choice in the hope that this choice will lead to a globally-optimal.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |