Join Patrick Royal for an in-depth discussion in this video Solution overview, part of Code Clinic: Java.
- View Offline
- Exercise Files
The Eight Queens problem is a classic example…of a program that is easy to complete,…but hard to complete quickly.…In just a few lines of code,…you could write a brute force algorithm…that placed eight queens in random squares…on a chess board and then check to see…if they met the requirements for this problem.…However, this would require 64 factorial…over 56 factorial…or about 1.78 times 10 to the 14th tries…to find all the solutions.…This is obviously computationally unfeasible.…
Instead, my solution uses some easy to prove facts…about the eventual placement of the queens to…dramatically reduce the number of positions required.…The first step in this challenge is figuring out…how to represent a chessboard.…This is a great example of the importance of…having the right data structure for the job.…Intuitively, the obvious choice would be to have…a two-dimensional 8x8 array or array list…where the location of each point corresponds to…its coordinates on the chessboard.…While it is certainly possible to complete the problem…
Patrick introduces challenges and provide an overview of his solutions in Java. Challenges include topics such as statistical analysis, searching directories for images, and accessing peripheral devices.
Visit other courses in the series to see how to solve the exact same challenges in languages like C#, C++, PHP, Python, and Ruby.
Skill Level Intermediate
Problem One: Exploring Lake Pend Oreille
Problem Two: Image Analysis
Problem Three: Eight Queens
Problem Four: Accessing Peripherals
Problem Five: Recursion and Directories
Problem Six: Building the Web
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.