Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
Node is saved as draft in My Content >> Draft
  • Greedy Algorithm in C

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 61
    Comment on it

    For finding the optimum solution of the problem greedy algorithm is used for it. It can solve problem from any domain we want.

     

    Greedy algorithm try to find localized solution which may comes inside global solutions.

     

     

     


    T

    his problem is to count to a desired value by chosing least possible coins and greedy approach forces the algorithm to pick the largest possible coin. If we are provided coins of  1, 2, 5 and 10 and we are asked to count  18 then the greedy procedure will be 
    
        1  Select one  10 coin, remaining count is 8
    
        2  Then select one  5 coin, remaining count is 3
    
        3  Then select one  2 coin, remaining count is 1
    
        3  And finally selection of one  1 coins solves the problem

     

     

    Examples

    Most networking algorithms uses greedy approach. Here is the list of few of them −

    • Travelling Salesman Problem
    • Prim's Minimal Spanning Tree Algorithm
    • Kruskal's Minimal Spanning Tree Algorithm
    • Dijkstra's Minimal Spanning Tree Algorithm
    • Graph - Map Coloring
    • Graph - Vertex Cover
    • Knapsack Problem
    • Job Scheduling Problem

     

    .net

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: