Explore tens of thousands of sets crafted by our community.
Greedy Algorithms
8
Flashcards
0/8
Prim's Algorithm
Strategy: Grow a minimum spanning tree by starting from an arbitrary node and repeatedly adding the cheapest edge that extends the tree. Example: Constructing minimum spanning trees in network optimization.
Coin Change Problem
Strategy: Make change for a particular amount of money with the fewest coins by choosing the largest coin value that does not exceed the remaining amount. Example: Cashier systems for returning the minimal number of coins as change.
Huffman Coding
Strategy: Create a variable-length, prefix-free binary code for encoding data with the most frequent pieces of data using the shortest codes. Example: Data compression algorithms like file compression tools.
Dijkstra's Algorithm
Strategy: Find the shortest paths from a single source to all other vertices by iteratively selecting the vertex with the smallest known distance and updating its neighbors' distances. Example: GPS navigation systems for finding shortest driving routes.
Activity Selection Problem
Strategy: Select the maximum number of activities that don't overlap by always choosing the next activity that finishes first. Example: Scheduling tasks within given time slots without overlaps.
Fractional Knapsack Problem
Strategy: Maximize total value in a knapsack with limited capacity by selecting fractions of items based on the ratio of value to weight. Example: Resource allocation problems where division of resources is possible.
Kruskal's Algorithm
Strategy: Build a minimum spanning tree by choosing edges in increasing order of weight, ignoring those that form a cycle. Example: Finding the minimum spanning tree in a weighted graph.
Job Sequencing with Deadlines
Strategy: Maximize profit by scheduling jobs to occur before their deadlines while considering profit—schedule jobs with the highest profit first. Example: Any scheduling problem where tasks have deadlines and profits associated with timely completion.
© Hypatia.Tech. 2024 All rights reserved.