Performance Comparison of Greedy and Dynamic Programming Algorithms for E-Commerce Shopping Cart Discount Optimization Using the Online Retail UCI Dataset
DOI:
https://doi.org/10.58466/f0fdve41Keywords:
Greedy Algorithm, Dynamic Programming, Shopping Cart Optimization, Knapsack Problem, E-CommerceAbstract
E-commerce platforms heavily rely on automated promotional strategies, such as tiered discounts, to enhance customer loyalty. Therefore, this study aims to analyze the performance of computational algorithms in determining item priorities within a shopping cart under promotional budget constraints. The 0/1 Knapsack Problem was addressed by comparing two computational approaches: Dynamic Programming (DP) and the Greedy Algorithm. Transaction data from the UCI Online Retail dataset were cleaned and aggregated into 3,746 unique product catalogs, then simulated using a promotional budget limit of £499.40 with a 10% discount policy. Computational experiments revealed contrasting trade-off characteristics between the two approaches. The DP algorithm guaranteed an absolute optimal solution with a total profit of £2,725,575.77 but required 28.10 seconds of computation time. In contrast, the Greedy algorithm completed the selection process in a fraction of a second (0.17 seconds) while incurring only a marginal profit deficit of 0.01%. The Greedy heuristic approach proved to be highly practical and efficient for integration into real-time user interface systems, whereas the superior accuracy of DP makes it more suitable for offline database processing and inventory analytics research.
References
[1] A. A. Anjani and H. Hasma, “Analisis Perancangan Sistem Informasi Akuntansi Penjualan Tunai Pada Toko Berkah Jaya,” Jurnal Syntax Admiration, vol. 3, no. 4, pp. 653–673, Apr. 2022, doi: 10.46799/jsa.v3i4.421.
[2] Feby Juliana Silalahi, Zulfahmi Indra, and Fatima Asro Harahap, “Analisis Perbandingan Kinerja Algoritma Pemrograman Dinamis dan Greedy dalam Penyelesaian Masalah Knapsack,” vol. 15, no. 10, pp. 1–11, Oct. 2024.
[3] R. A. Prasetyo, H. Saputra, W. N. Dewi, and P. Rizqiyah, “Eksplorasi Data Mining Dengan Teknik Statistik Untuk Pengolahan Big Data Transaksi Online,” 2025. [Online]. Available: https://ejournal.unjaya.ac.id/index.php/ijds
[4] S. M. AZ, R. Ratna, A. Fithoni, and Rts. H. Delima, “Pengaruh Diskon, Promosi dan Kualitas Pelayanan terhadap Keputusan Pembelian Online dengan Menggunakan Aplikasi Alfagift,” Jurnal Ilmiah Universitas Batanghari Jambi, vol. 24, no. 3, p. 2938, Oct. 2024, doi: 10.33087/jiubj.v24i3.5695.
[5] A. Rondy, J. Kusanti, and A. Rianto, “Implementasi Data Mining dalam Menganalisis Pola Pembelian Produk Toko Oleh-Oleh Umrah dan Haji,” 2024.
[6] W. Widhiarso, “Optimasi Keputusan Repeat-Order Marchandise K-Pop Menggunakan Algoritma Greedy Berdasarkan Matriks Profitabilitas dan Tren,” Jurnal Komputer Teknologi Informasi Sistem Informasi (JUKTISI), vol. 4, no. 3, pp. 2158–2162, Feb. 2026, doi: 10.62712/juktisi.v4i3.829.
[7] D. Wungguli, S. S Ibrahim, and L. Yahya, “Perbandingan Algoritma Greedy Dan Metode Branch And Bound Pada Penyelesaian Knapsack 0-1 Untuk Mengoptimalkan Muatan Barang,” JURNAL ILMIAH MATEMATIKA DAN TERAPAN, vol. 18, no. 2, pp. 188–198, Dec. 2021, doi: 10.22487/2540766x.2021.v18.i2.15605.
[8] Asyraf Muntasir Pratama, Siswanto, and Ricky Zulfiandry, “Implementasi Data Mining Untuk Analisis Prilaku,” Jurnal Media Infotama, vol. 21, no. 2, p. 703, 2025.
[9] Ramadani Saputra and Alexander J.P. Sibarani, “Implementasi Data Mining Menggunakan Algoritma Apriori Untuk Meningkatkan Pola Penjualan Obat,” Aug. 2020. doi: https://doi.org/10.35957/jatisi.v7i2.195.
[10] Vina Virshella, Sylvi Herdyana, Frans Tanue, and Julia Loisa, “Perancangan Sistem Pembelian dan Analisis Barang Dagang Pada Divisi Household PT Puncak Prima Lestari,” Jurnal Teknologi Dan Sistem Informasi Bisnis, vol. 6, no. 2, pp. 379–389, Apr. 2024, doi: 10.47233/jteksis.v6i2.1284.
[11] Fiqih Satria and M. Husaini, “Analisis Data Mining Strategi Digital Marketing terhadap Keputusan Pembelian Mahasiswa,” JIKO (Jurnal Informatika dan Komputer), vol. 9, no. 2, p. 427, Jun. 2025, doi: 10.26798/jiko.v9i2.1910.
[12] B. Nurislah and D. Gustian, “Penerapan Data Mining untuk Analisis Pola Pembelian Pelanggan Menggunakan Algoritma Apriori,” Feb. 2024. doi: https://doi.org/10.52005/rekayasa.v10i1.427.
[13] L. Sun, “A Comparative Study of Traditional and Machine Learning Approaches for E-Commerce Sales Forecasting,” 2024, doi: 10.54254/2754-1169/135/2024.18610.
[14] Nahdah Faizah Harahap and Elvi Mailani, “Pengembangan E-LKPD Berbasis QR Code melalui Model Problem Based Learning pada Materi Bangun Datar di Kelas IV Sekolah Dasar,” Juni, vol. 14, Dec. 2023, doi: 10.24114/jh.v14i2.47398.
[15] S. Sylviani, H. Hazel Pernanda Putra, and F. C. Permana, “Analisis Algoritma Greedy Untuk Mewarnai Graf,” Diophantine Journal of Mathematics and Its Applications, vol. 3, pp. 30–39, Jun. 2024, doi: 10.33369/diophantine.v3i1.32261.
Downloads
Published
Issue
Section
License
Copyright (c) 2026 Jonathan Tanujaya, Daffa Yudha Musyaffa, Yohannes Yohannes

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




