Comparative Analysis of Greedy and Dynamic Programming Algorithms for Optimizing Spotify Playlists for Jogging
DOI:
https://doi.org/10.58466/1htfcz49Keywords:
Spotify Playlist Optimization, Greedy Algorithm, Dynamic Programming, 0/1 Knapsack Problem, Music RecommendationAbstract
Spotify provides audio metadata that can be utilized to support physical activities such as jogging. This study compares the performance of Greedy and Dynamic Programming algorithms for Spotify playlist optimization modeled as a 0/1 Knapsack Problem. Song duration is treated as weight, while a score derived from popularity and energy is used as value. The dataset was obtained from Spotify Wrapped 2025 Top 50 Songs and Spotify All-Time Top 100 Songs, resulting in 31 candidate songs after preprocessing and filtering. Experiments were conducted on playlist durations of 30, 45, 60, 75, and 90 minutes. The results show that Dynamic Programming consistently achieved higher total scores than Greedy across all scenarios. For the 60-minute playlist, Dynamic Programming obtained a total score of 1897 compared to 1894 achieved by Greedy. However, Greedy required a lower execution time (4.244 ms) than Dynamic Programming (16.196 ms). The average optimality gap between the two methods was 1.89%, indicating that Greedy produced solutions that were close to the optimal solutions generated by Dynamic Programming while requiring less computation time.
References
[1] K. S. Park, D. M. Williams, and J. L. Etnier, “Exploring the use of music to promote physical activity: From the viewpoint of psychological hedonism,” Front. Psychol., vol. 14, p. 1021825, Jan. 2023, doi: 10.3389/fpsyg.2023.1021825.
[2] S. Delleli et al., “The effects of pre-task music on exercise performance and associated psy-cho-physiological responses: a systematic review with multilevel meta-analysis of controlled studies,” Front. Psychol., vol. 14, p. 1293783, Nov. 2023, doi: 10.3389/fpsyg.2023.1293783.
[3] A. Danso et al., “Personalized Interactive Music Systems for Physical Activity and Exercise: Exploratory Systematic Review and Meta-Analysis,” JMIR Hum. Factors, vol. 12, pp. e70372–e70372, Sep. 2025, doi: 10.2196/70372.
[4] G. Gabbolini and D. Bridge, “Surveying More Than Two Decades of Music Information Retrieval Re-search on Playlists,” ACM Trans. Intell. Syst. Technol., vol. 15, no. 6, pp. 1–68, Dec. 2024, doi: 10.1145/3688398.
[5] F. Tomasi, J. Cauteruccio, S. Kanoria, K. Ciosek, M. Rinaldi, and Z. Dai, “Automatic Music Playlist Generation via Simulation-based Reinforcement Learning,” in Proceedings of the 29th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, Long Beach CA USA: ACM, Aug. 2023, pp. 4948–4957. doi: 10.1145/3580305.3599777.
[6] W. Bendada, G. Salha-Galvan, T. Bouabça, and T. Cazenave, “A Scalable Framework for Automatic Playlist Continuation on Music Streaming Services,” in Proceedings of the 46th International ACM SIGIR Conference on Research and Development in Information Retrieval, Taipei Taiwan: ACM, Jul. 2023, pp. 464–474. doi: 10.1145/3539618.3591628.
[7] V. Cacchiani, M. Iori, A. Locatelli, and S. Martello, “Knapsack problems — An overview of recent advances. Part I: Single knapsack problems,” Comput. Oper. Res., vol. 143, p. 105692, Jul. 2022, doi: 10.1016/j.cor.2021.105692.
[8] V. Cacchiani, M. Iori, A. Locatelli, and S. Martello, “Knapsack problems — An overview of recent advances. Part II: Multiple, multidimensional, and quadratic knapsack problems,” Comput. Oper. Res., vol. 143, p. 105693, Jul. 2022, doi: 10.1016/j.cor.2021.105693.
[9] J. R. Lee, “Spectral Hypergraph Sparsification via Chaining,” in Proceedings of the 55th Annual ACM Symposium on Theory of Computing, Orlando FL USA: ACM, Jun. 2023, pp. 207–218. doi: 10.1145/3564246.3585165.
[10] Y. Wu, “Comparison of dynamic programming and greedy algorithms and the way to solve 0-1 knapsack problem,” Appl. Comput. Eng., vol. 5, no. 1, pp. 631–636, May 2023, doi: 10.54254/2755-2721/5/20230666.
[11] X. Chen, “A Comparison of Greedy Algorithm and Dynamic Programming Algorithm,” SHS Web Conf., vol. 144, p. 03009, 2022, doi: 10.1051/shsconf/202214403009.
[12] M. Te Brake, N. Stolwijk, B. Staal, and B. Van Hooren, “Using beat frequency in music to adjust running cadence in recreational runners: A randomized multiple baseline design,” Eur. J. Sport Sci., vol. 23, no. 3, pp. 345–354, Mar. 2023, doi: 10.1080/17461391.2022.2042398.
[13] J. Wu, L. Zhang, H. Yang, C. Lu, L. Jiang, and Y. Chen, “The Effect of Music Tempo on Fatigue Per-ception at Different Exercise Intensities,” Int. J. Environ. Res. Public. Health, vol. 19, no. 7, p. 3869, Mar. 2022, doi: 10.3390/ijerph19073869.
[14] Y. Wang, “Review on greedy algorithm,” Theor. Nat. Sci., vol. 14, no. 1, pp. 233–239, Nov. 2023, doi: 10.54254/2753-8818/14/20241041.
[15] Y. Zhang, “A survey of dynamic programming algorithms,” Appl. Comput. Eng., vol. 35, no. 1, pp. 183–189, Feb. 2024, doi: 10.54254/2755-2721/35/20230392.
Downloads
Published
Issue
Section
License
Copyright (c) 2026 Fadhel Muhammad , Muhammad Radja Juang Jamemiko, Yohannes Yohannes

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.




