-
Notifications
You must be signed in to change notification settings - Fork 497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Backtracking algorithm (N-Queen Problem) [Go] #536
Conversation
Hi! Thanks for showing interest in contributing to this repository. Please make sure that you have ticked the points mentioned in PR description correctly. Thanks again! |
n_queen_problem/n_queen_problem.go
Outdated
func main() { | ||
var n int | ||
print("Enter the value of 'N' ") | ||
fmt.Scanf("%d", &n) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to ask the value of n
, take any sample value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I'll set it to 8
n_queen_problem/n_queen_problem.go
Outdated
return false | ||
} | ||
|
||
func placeQueen(b *[][]int, n int) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please export this func.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what that exactly means but changed the function name to PlaceQueen
and added a comment before it as explanation.
n_queen_problem/n_queen_problem.go
Outdated
n := 8 // size of chess board (n x n) | ||
|
||
// make board | ||
b := make([][]int, n) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use common variable names such as, n => size, b => board.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that makes more sense. Done.
Fixes #535
By submitting this pull request I confirm I've read and complied with the below declarations.
Added {Algorithm/DS name} [{Language}]
, notUpdate README.md
orAdded new code
.