Join Patrick Royal for an in-depth discussion in this video My solution: Writing the recursive algorithm, part of Code Clinic: Java.
Now that we've decided on a data structure to use…and found an efficient brute force technique,…it's time to look at the algorithm itself.…The bulk of my actual algorithm is found…in the "Place Queens" method.…This method uses recursion to try all possible…queen placements, returning true if the placement…works and false if if doesn't.…Let's take a look at the structure…of this recursive method.…Every recursive function has two parts,…a base case and a recursion step.…
The base case is designed to be a trivial situation…usually where the input is zero or null…that can be solved in just a few steps.…Eventually, every branch of the function must get…to a base case so that it can terminate.…If it doesn't then your recursion…is just going to go on forever.…The recursion step is a block of code that calls…the method again, but with different inputs.…Each recursive call should move…the inputs closer to being trivial.…
In this case, closer can be defined in a variety…of different ways, but it usually involves…dividing up the input or throwing part of it away.…
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
Q: I am unable to access the Lake Pend Oreille data from outside the U.S.
A: A static copy of this data is provided here for lynda.com members outside of the U.S
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.