- [Instructor] In this code clinic,…we're attempting the very famous eight queens problem.…This can either be easy or complex for a computer to solve.…Depending on the approach that you take.…There are two important considerations.…The data structure that you choose,…and the number of times you have to loop…to your chosen data structure.…If you attempt to code this program yourself,…and it runs very slow,…chances are your chosen data structure is too big.…
Or you're scanning through it millions of times.…In our solution, we have chosen an array…of eight numbers to represent the chessboard.…Each array cell represents one row,…and each number that you see inside the cells…is a number from zero to seven,…representing the eight columns.…For a total of 64 cells.…For a human, it's hard to look at this data structure…to see whether the board with eight queens on it…is valid or not.…
But from the computer's point of view,…this is a very small data structure…that can be searched and validated…millions of times very quickly.…
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
1. Problem 1: Pond Oreille
2. Problem 2: Where Am I?
3. Problem 3: Eight Queens
4. Problem 4: Accessing Peripherals
5. Problem 5: Facial Recognition
6. Problem 6: Real-Time Information Dashboard
- 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.