Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cours
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
algorithmique
cours
Commits
60f00c7c
Commit
60f00c7c
authored
3 years ago
by
paul.albuquer
Browse files
Options
Downloads
Patches
Plain Diff
Corrected typos in N-queens code in cours_8.md
parent
a48b48e2
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#14927
failed
3 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
slides/cours_8.md
+5
-4
5 additions, 4 deletions
slides/cours_8.md
with
5 additions
and
4 deletions
slides/cours_8.md
+
5
−
4
View file @
60f00c7c
...
...
@@ -178,7 +178,7 @@ bool board[n][n];
// et compter les solutions
void nbr_solutions(board, column, counter);
// Copier un tableau dans un autre
void copy(board_in, board);
void copy(board_in, board
_out
);
// Placer la reine à li, co et rendre inaccessible devant
void placer_devant(board, li, co);
```
...
...
@@ -193,8 +193,9 @@ nbr_solutions(board, column, count)
// pour chaque ligne
// si la case libre
// si column < n - 1
// copier dans un "new" board, y poser
// une reine et mettre à jour ce "new" board
// copier board dans un "new" board,
// y poser une reine
// et mettre à jour ce "new" board
// nbr_solutions(new_board, column+1, count)
// sinon
// on a posé la n-ème et on a gagné
...
...
@@ -230,7 +231,7 @@ void nb_sol(int n, bool board[n][n], int co, int *ptr_cpt) {
if (board_in[li][co]) {
if (co < n-1) {
bool new_board[n][n]; // alloué à chaque nouvelle tentative
copy(n,
new_
board
_in,
board);
copy(n, board
, new_
board);
prises_devant(n, new_board, li, co);
nb_sol(n, new_board, co+1, ptr_cpt);
} else {
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment