The document proposes piece-picking algorithms for peer-to-peer live streaming and video-on-demand based on the knapsack problem. The piece-picking problem is closely related to the knapsack problem and existing knapsack algorithms can be analyzed and improved to meet requirements. Various knapsack-based algorithms are evaluated for complexity, dependency on network conditions, and applicability to different settings. The goal is to find the optimal tradeoff between smooth playback and highest possible video quality by selecting the best pieces to download from peers.