Join Bill Weinman for an in-depth discussion in this video Implementation, part of Code Clinic: C++.
- The n-queens problem is a fairly simple searching problem.…if we look here in the main function…you'll notice that the n q class is used to construct…an object called q.…And it's constructed with this n value,…which is simply the number that is typed…on the command line.…And you see it's converted to an integer here…an unsigned integer with the a to i function.…Then the object has it's flag set based on the…command line switch, whether we're going to show…the board or just the short summary or nothing.…
And then this solve method is called.…And that actually does the solution,…and displays the result.…So let's take a look over here at the n q class.…And you notice our constructor here,…it calls a nit, and a nit simply allocates space…and that's all that's done on construction of the object.…The rest of the work is done down here in the solve method,…the solve method called solve row with a zero.…And solve row is a recursive function,…or method, it steps through all of the…possible spaces in a given row,…and once it finds a safe solution,…
Bill introduces challenges and provides an overview of his solutions in C++. 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#, Java, PHP, Python, and Ruby.
Skill Level Intermediate
Problem One: Exploring Lake Pend Oreille
Solution overview2m 51s
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.