This commit is contained in:
krahets
2024-05-02 01:46:20 +08:00
parent 5e90519796
commit 23353e7960
324 changed files with 420 additions and 419 deletions
@@ -3626,7 +3626,7 @@
<p align="center"> Figure 15-4 &nbsp; Value per unit weight of the item </p>
<h3 id="1-greedy-strategy-determination">1. &nbsp; Greedy strategy determination<a class="headerlink" href="#1-greedy-strategy-determination" title="Permanent link">&para;</a></h3>
<p>Maximizing the total value of the items in the knapsack essentially means maximizing the value per unit weight. From this, the greedy strategy shown in Figure 15-5 can be deduced.</p>
<p>Maximizing the total value of the items in the knapsack <strong>essentially means maximizing the value per unit weight</strong>. From this, the greedy strategy shown in Figure 15-5 can be deduced.</p>
<ol>
<li>Sort the items by their unit value from high to low.</li>
<li>Iterate over all items, <strong>greedily choosing the item with the highest unit value in each round</strong>.</li>
@@ -4284,7 +4284,7 @@ aria-label="Footer"
<div class="md-copyright">
<div class="md-copyright__highlight">
Copyright &copy; 2022-2024 krahets<br>The website content is licensed under <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a>
Copyright &copy; 2024 krahets<br>The website content is licensed under <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a>
</div>