Title: N-Queens Recursion vs. Stack Algorithm
Course: CPS 261: Advanced Java Concepts ~ DL & MM MASTER > Section: Learning Units - Bb

Presentations and Videos

- N-Queens Recursion vs. Stack Algorithm lecture video (Time: 32:00)
- N-Queens Recursion vs. Stack Algorithm document

- The N-Queens problem can be defined as having N queens on a board (like a chessboard) which has N rows and N columns. Note that N can be 4, 5, ....8, 9, 10, ....Our job is to place the N queens on the board such that none of the queens can be attacked by any of the other queens.
- In this lecture, we demonstrate 2 ways to solve the problem. One is with recursion and the other is with a stack.
- To demonstrate the algorithm we connect our problem solver to some additional code which draws the board and slows down the solver so that you can see the algorithm in action (we slow it down to have a second between each new step).
- To make all of this happen we make use of earlier concepts discussed in this course including: Threads, sleep, wait, notify, etc.