mirror of
https://github.com/krahets/hello-algo.git
synced 2026-08-31 12:27:13 +00:00
deploy
This commit is contained in:
@@ -3626,7 +3626,7 @@
|
||||
<p align="center"> Figure 15-4 Value per unit weight of the item </p>
|
||||
|
||||
<h3 id="1-greedy-strategy-determination">1. Greedy strategy determination<a class="headerlink" href="#1-greedy-strategy-determination" title="Permanent link">¶</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 © 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 © 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>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user