Penggunaan algoritma Backtracking untuk Penyelesaian Masalah N-Queens: Studi Perbandingan Iteratif dan Rekursif

Authors

  • Rachmat Adiaz Arrofi Universitas Bina darma
  • M.Erlangga Fauzi Universitas Bina darma
  • Tata Sutabri Universitas Bina Darma

DOI:

https://doi.org/10.51903/x68fky35

Keywords:

Backtracking, N-Queens, Rekursif, Iteratif, Efisiensi Algoritma

Abstract

The N-Queens problem is a classic problem in computer science that requires the placement of N queens on an NxN chessboard without attacking each other. One of the common algorithmic approaches used to solve this problem is the backtracking algorithm, which is a technique for finding solutions by systematically trying all possibilities and backtracking when reaching a dead end. This study compares two implementation methods of the backtracking algorithm, namely the recursive and iterative approaches, in the context of solving the N-Queens problem. The focus of this study is to analyze the performance of the two approaches based on execution time, memory efficiency, and program code complexity. Experiments were conducted on various board sizes (N=4 to N=20) using the Python programming language. The test results show that the recursive approach has a simpler and easier-to-understand code structure, but is susceptible to stack overflow at large N values. Meanwhile, the iterative approach is more complex in its implementation, but tends to be more stable and efficient in the use of computer resources. This study contributes to a comparative understanding of the two approaches, as well as being a reference in choosing the right programming strategy to solve other combinatorial problems.

References

[1] A. Adrifina, S. Wati, and U. Gunadarma, “Penyelesaian Masalah N-Queen Dengan Teknik Backtracking,” no. Kommit, pp. 20–21, 2008.

[2] Rahmawati yunia, “Penerapan Algoritma Backtracking Pada N-Queen Problem Permainan Catur,” vol. 3, no. July, pp. 1–23, 2020.

[3] N. Nurhasanah and U. Saptoni, “Penerapan Algoritma Backtracking Dengan Bounding Function Dan Depth First Search Pada Permainan Boggle,” J. Tek. Inform. dan Elektro, vol. 5, no. 2, pp. 35–50, 2023, doi: 10.55542/jurtie.v5i2.699.

[4] J. Sains, V. Akassatya, and A. Putri, “Analisis Efisiensi dan Kompleksitas Algoritma Backtracking dalam Permainan Math Maze,” vol. 1, no. 1, pp. 18–28, 2025.

[5] Muhammad Ali Zafar Sidiq, Aldi Supriyadi, and Asti Herliana, “Perbandingan Keefektifan Algoritma Backtracking Dan Soft Computing Dalam Memecahkan Permainan Papan Nonogram,” J. Tek. Inform. dan Teknol. Inf., vol. 3, no. 1, pp. 09–19, 2023, doi: 10.55606/jutiti.v3i1.2069.

[6] M. H. Rifqo and Y. Apridiansyah, “Implementasi Algoritma Backtracking Dalam Sistem Informasi Perpustakaan Untuk Pencarian Judul Buku (Studi Kasus Unit Pelayanan Terpadu Perpustakaan Universitas Muhammadiyah Bengkulu),” Pseudocode, vol. 4, no. 1, pp. 90–96, 2017, doi: 10.33369/pseudocode.4.1.90-96.

[7] D. R. Saputra, T. Sutabri, M. T. Informatika, U. B. Darma, and B. Islami, “Pengembangan Strategi Pemasaran Berbasis Algoritma Backtracking untuk Meningkatkan Engagement dan Penjualan pada Butik Islami,” vol. 19, no. x, pp. 587–596, 2025.

[8] A. C. Billan and T. Sutabri, “Restorasi Penjadwalan Sumur Minyak Yang Mengalami Off-Time Menggunakan Algoritma Backtracking,” *Bull. Comput. Sci. Res.*, 2025.

[9] R. Angel, W. Wilda, and A. N. Yasinta, “Penerapan Algoritma Backtracking Berbasis BFS dengan Pendekatan Heuristik dalam Permainan Hangman,” *J. Ilmiah Multidisipline*, 2023.

[10] R. Krisdiawan, A. Fitriani, and H. Budanto, “Penerapan Algoritma Recursive Backtracking Sebagai Maze Generator Pada Game Labirin Aksara Sunda,” *Media J. Inform.*, 2022.

[11] M. J. Budiman and F. J. Doringin, “Judul Tidak Dicantumkan,” *J. Ilmu Komputer*, 2025.

[12] R. Krisdiawan and A. Permana, “Rancang Bangun Game Treasure of Labyrinth Dengan Algoritma Backtracking,” *J. Nuansa Inform.*, 2020.

[13] A. A. Hanafi, N. Hibban, and F. M. Zulfikar, “Penyelesaian Permainan Sudoku Menggunakan Algoritma Backtracking Berbasis Artificial Intelligence,” *J. ICTEE*, 2021.

[14] J. E. Lakotany, E. R. Persulessy, and Y. A. Lessnusa, “Aplikasi Algoritma Backtracking Untuk Menentukan Rute Optimal Distribusi Air Isi Ulang Gonzalo Di Kota Ambon,” *BAREKENG: J. Ilmu Mat. dan Terap.*, 2020.

[15] M. Khouirssoulih and G. Wicaksono, “Penyelesaian Masalah 8-Queen Dengan Depth First Search Menggunakan Algoritma Backtracking,” *Setrum: Syst. Kendali-Tenaga-Elektro-Telekom-Komput.*, 2016.

[16] A. Tando, “Penerapan Pohon dengan Algoritma Branch and Bound dalam Menyelesaikan N-Queen Problem,” 2012.

[17] P. Anderson, X. He, C. Buehler, and D. Teney, “Bottom-Up and Top-Down Attention for Image Captioning and Visual Question Answering,” in *Proc. IEEE Conf. Comput. Vis. Pattern Recognit. (CVPR)*, 2018.

[18] E. Rahmawati, P. Medina, D. Azhari, and M. F. Dewi, “Rekursif Dalam Pemrograman Teori Dan Praktek,” 2024.

[19] J. Sains, D. Parastia, and D. A. Nugroho, “Review Penerapan Algoritma Backtracking Dalam Beberapa Bidang,” 2025.

[20] T. Sutabri, *Sistem Informasi Bisnis*, Yogyakarta: Andi, 2019.

[21] T. Sutabri, *Konsep Sistem Informasi*, Yogyakarta: Andi, 2012.

Downloads

Published

2025-05-01

How to Cite

Penggunaan algoritma Backtracking untuk Penyelesaian Masalah N-Queens: Studi Perbandingan Iteratif dan Rekursif. (2025). Jurnal Manajemen Informatika & Teknologi, 5(1), 126-140. https://doi.org/10.51903/x68fky35

Similar Articles

1-10 of 18

You may also start an advanced similarity search for this article.

Most read articles by the same author(s)