Lecture 11 | Programming Abstractions (Stanford)

Stanford · 79K views · 2008 · 47:48

Open on YouTube

Algorithms & data structuresUniversity lectures & courseslecture

Why Stack Overflow recommends it

Stack Overflow users link it when asking about or explaining recursive backtracking, especially for solving Sudoku and enumerating solutions.

Recommended by 2 people across 2 different months, 2010 to 2013.

What it is

A Stanford CS106B lecture by Julie Zelenski on recursive backtracking, pointers and recursive data. It works through a Sudoku solver as the main example and stresses spotting patterns across recursion problems.

Cited in 1 Wikipedia article, including Sudoku solving algorithms.

What people said

Recommends johncip · 2010-07 · Stack Overflow · on “Explain BFS and DFS in terms of backtracking”

The confusion comes in because backtracking is something that happens during search, but it also refers to a specific problem-solving technique where a lot of backtracking is done. Such programs are called backtrackers. Picture driving into a neighborhood, always taking the first turn you see (let's assume there are no loops) until you hit a dead end, at which point you drive back to the intersection of the next unvisited street. This is the "first" kind of backtracking, and it's roughly equivalent to colloquial usage of the word. The more specific usage refers to a problem-solving strategy that is similar to depth-first search but backtracks when it realizes that it's not worth continuing d

Recommends Bjarn127 · 2013-08 · Stack Overflow · on “Recursively Solving A Sudoku Puzzle Using Backtracking Theoretically”

Answer: My pseudo is fuzzy in the recursive aspect but this video is helpful along with the resources below [this video] [LINK] Can't grasp the implementation of this backtrack recursive algorithm in respect to a sudoku puzzle. I'm trying to solve a sudoku puzzle using recursive backtracking. I've been still unable to wrap the general algorithm around in my head given the problem domain I'm working in. The backtracking algorithm I'm trying to use seems standard but I can't follow the logic and know whats happening underneath. Included is the backtracking algorithm and its definition. Edit: "Again, took out the class definition, left the declaration and put up the pseudo code" Here's my pseudocode

Cites PieThon · 2013-01 · Stack Overflow · on “Sudoku Solving with backtracking algorithm”

I saw this lecture on youtube: [this video] and there is the code i wrote: int _Solve(int iRow, int iCol) { if (iRow == 9) return 1; if (arrBoard[iRow][iCol]) { iRow = (iCol == 8) ? iRow + 1 : iRow; iCol = (iCol == 8) ? 0 : iCol + 1; if(_Solve(iRow, iCol)) return 1; return 0; } int iNewNum, iOldRow, iOldCol; for (iNewNum = 1; iNewNum <= SIZE; iNewNum++) { if (IsValid(iNewNum, iRow, iCol)) { arrBoard[iRow][iCol] = iNewNum; iOldRow = iRow; iOldCol = iCol; iRow = (iCol == 8) ? iRow + 1 : iRow; iCol = (iCol == 8) ? 0 : iCol + 1; if (_Solve(iRow, iCol)) return 1; iRow = iOldRow; iCol = iOldCol; arrBoard[iRow][iCol] = 0; } } return 0; } but it doesnt work, after i print my arrBoard, what i get it every

Cites dylanmensaert · 2013-03 · Stack Overflow · on “How to get all possible solutions using backtracking algorithm?”

I'm using the backtracking algorithm described in this YouTube video [this video] . Now, I should be able to get ALL possible solutions. Am I able to do this with the backtracking algorithm and how? If not possible, which other (simple) algorithm should I use?