Looking for clarity on step in fractional knapsack problem proof
All appearances of $q_i$ on the RHS are errors -- they should be replaced with $o_i$. I imagine the author was thinking of &quot;initialising&quot; $Q$ to be equal to $O$, and then updating its elements in-place.
Another minor issue I have is with the line &quot;After this procedure is done, the total value of the solution $Q$ is equal to the total value of $O$ (make sure youunderstand why!)&quot;. This is true, but as this is the key part of an introductory proof, I think it would have been better to break it into its two parts:

For any $k &gt; j$, moving positive weight from $o_k$ to $o_j$ results in a solution with value $\ge$ the original solution.
The original solution $O$ was assumed optimal, so the $\ge$ becomes a $=$.