This commit is contained in:
krahets
2026-08-18 03:09:26 +08:00
parent 0375f25b66
commit fde23f369e
158 changed files with 312 additions and 282 deletions
@@ -5050,7 +5050,7 @@
<li><strong>Fractional knapsack problem</strong>: Given a set of items and a carrying capacity, your goal is to select a set of items such that the total weight does not exceed the carrying capacity and the total value is maximized. If you always choose the item with the highest value-to-weight ratio (value / weight), then the greedy algorithm can obtain the optimal solution in some cases.</li>
<li><strong>Stock trading problem</strong>: Given a set of historical stock prices, you can make multiple trades, but if you already hold stocks, you cannot buy again before selling, and the goal is to obtain the maximum profit.</li>
<li><strong>Huffman coding</strong>: Huffman coding is a greedy algorithm used for lossless data compression. By constructing a Huffman tree and always merging the two nodes with the lowest frequency, the resulting Huffman tree has the minimum weighted path length (encoding length).</li>
<li><strong>Dijkstra's algorithm</strong>: It is a greedy algorithm for solving the shortest path problem from a given source vertex to all other vertices.</li>
<li><strong>Dijkstra's algorithm</strong>: For graphs with non-negative edge weights, it is a greedy algorithm for solving the shortest path problem from a given source vertex to all other vertices.</li>
</ul>
<!-- Source file information -->