Skip to content
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

Merged
merged 3 commits into from
Oct 17, 2017

Conversation

vatz88
Copy link
Contributor

@vatz88 vatz88 commented Oct 14, 2017

Fixes #535

By submitting this pull request I confirm I've read and complied with the below declarations.

  • I have read the Contribution guidelines and I am confident that my PR reflects them.
  • I have followed the coding guidelines for this project.
  • My code follows the skeleton code structure.
  • This pull request has a descriptive title. For example, Added {Algorithm/DS name} [{Language}], not Update README.md or Added new code.
  • This pull request will be closed if I fail to update it even once in a continuous time span of 7 days.

@singhpratyush
Copy link
Member

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!

func main() {
var n int
print("Enter the value of 'N' ")
fmt.Scanf("%d", &n)
Copy link
Member

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.

Copy link
Contributor Author

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

return false
}

func placeQueen(b *[][]int, n int) bool {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please export this func.

Copy link
Contributor Author

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 := 8 // size of chess board (n x n)

// make board
b := make([][]int, n)
Copy link
Member

@mohitkyadav mohitkyadav Oct 14, 2017

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.

Copy link
Contributor Author

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.

@singhpratyush singhpratyush merged commit af4e87f into iiitv:master Oct 17, 2017
@vatz88 vatz88 deleted the n-queen-golong branch October 17, 2017 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Backtracking algorithm (N-Queen Problem) [Go]
3 participants