Skip to content

Add: [n-queens] in [c++]#185

Closed
JitinSaxenaa wants to merge 4 commits intoPradeepsingh61:mainfrom
JitinSaxenaa:n-queen
Closed

Add: [n-queens] in [c++]#185
JitinSaxenaa wants to merge 4 commits intoPradeepsingh61:mainfrom
JitinSaxenaa:n-queen

Conversation

@JitinSaxenaa
Copy link
Contributor

📌 Summary
This PR adds a comprehensive implementation of the N-Queens Problem in C++ to enhance the repository’s backtracking algorithms collection.

🚀 What's Added

  • File: CPP/algorithms/backtracking/n_queens.cpp
  • Complete N-Queens implementation using recursive backtracking
  • Well-documented code with detailed comments
  • Example usage and test cases included

📊 Algorithm Details

  • Time Complexity: O(N!) (worst-case due to permutations)
  • Space Complexity: O(N²) for board representation
  • Algorithm Type: Backtracking / Constraint Satisfaction Problem

✨ Key Features
✅ Clear function documentation
✅ Step-by-step implementation comments
✅ Example output demonstration (all possible solutions)
✅ Test cases covering multiple board sizes
✅ Follows repository naming conventions (snake_case)

🧪 Testing
The implementation includes test cases for:

  • N = 1 (trivial case)
  • N = 4 (first non-trivial valid case)
  • N = 8 (classic chessboard scenario)
  • Larger values of N for performance testing

📚 Code Quality

  • Clean, readable code structure
  • Comprehensive inline comments
  • Proper function separation (isSafe, solveNQueens, utility functions)
  • Example usage in main function

🎯 Contribution Type

  • Algorithm Implementation
  • Documentation
  • Code Examples
  • Following contribution guidelines

@github-actions
Copy link

🎉 Welcome to Hacktoberfest 2025, @JitinSaxenaa! 🎃

Thank you for your first contribution to our DSA repository! Here's what happens next:

🔍 Automatic Checks

  • Code Validation: Passed
  • 🧪 Compilation Tests: Passed

📋 Next Steps

🎯 Great job! Your code compiled successfully. Maintainers @Karanjot786 and @Pradeepsingh61 will review your PR soon.

🎁 What You Get

  • 🏆 Hacktoberfest Credit: This PR counts toward your 6 PR goal for exclusive T-shirt + Tree!
  • 🌟 Hall of Fame: You'll be featured in our contributors list
  • 📚 Learning: Code review feedback from experienced developers

💡 Tips for Success

  • Follow our Contributing Guidelines
  • Add comments explaining your algorithm
  • Include time/space complexity analysis
  • Test your code before submitting

Welcome to the community! 🚀

@github-actions
Copy link

🤖 Automated PR Status

🔍 Code Validation

Passed - File naming and structure look good!

🧪 Compilation Tests

Passed - All code compiles successfully!

📋 Overall Status

🎉 Ready for Review - Your PR has passed all automated checks!
👥 Maintainers have been notified for review.


This comment was generated automatically. Checks will re-run when you push new commits.

@Karanjot786
Copy link
Collaborator

Hi @JitinSaxenaa, can you change the directory of this file like this one CPP/algorithms/recursion/n_queen_problem.cpp

@github-actions
Copy link

github-actions bot commented Oct 1, 2025

🎉 Welcome to Hacktoberfest 2025, @JitinSaxenaa! 🎃

Thank you for your first contribution to our DSA repository! Here's what happens next:

🔍 Automatic Checks

  • Code Validation: Passed
  • 🧪 Compilation Tests: Failed

📋 Next Steps

⚠️ Action needed: Please fix the compilation errors and push your changes.

🎁 What You Get

  • 🏆 Hacktoberfest Credit: This PR counts toward your 6 PR goal for exclusive T-shirt + Tree!
  • 🌟 Hall of Fame: You'll be featured in our contributors list
  • 📚 Learning: Code review feedback from experienced developers

💡 Tips for Success

  • Follow our Contributing Guidelines
  • Add comments explaining your algorithm
  • Include time/space complexity analysis
  • Test your code before submitting

Welcome to the community! 🚀

@github-actions
Copy link

github-actions bot commented Oct 1, 2025

🤖 Automated PR Status

🔍 Code Validation

Passed - File naming and structure look good!

🧪 Compilation Tests

Failed - Please fix compilation errors and try again.

📋 Overall Status

⚠️ Needs Work - Please address the issues above.
💡 Push new commits to automatically re-run these checks.


This comment was generated automatically. Checks will re-run when you push new commits.

Implement N-Queens problem using backtracking with safety checks for queen placements.
@github-actions
Copy link

github-actions bot commented Oct 1, 2025

🎉 Welcome to Hacktoberfest 2025, @JitinSaxenaa! 🎃

Thank you for your first contribution to our DSA repository! Here's what happens next:

🔍 Automatic Checks

  • Code Validation: Passed
  • 🧪 Compilation Tests: Passed

📋 Next Steps

🎯 Great job! Your code compiled successfully. Maintainers @Karanjot786 and @Pradeepsingh61 will review your PR soon.

🎁 What You Get

  • 🏆 Hacktoberfest Credit: This PR counts toward your 6 PR goal for exclusive T-shirt + Tree!
  • 🌟 Hall of Fame: You'll be featured in our contributors list
  • 📚 Learning: Code review feedback from experienced developers

💡 Tips for Success

  • Follow our Contributing Guidelines
  • Add comments explaining your algorithm
  • Include time/space complexity analysis
  • Test your code before submitting

Welcome to the community! 🚀

@github-actions
Copy link

github-actions bot commented Oct 1, 2025

🤖 Automated PR Status

🔍 Code Validation

Passed - File naming and structure look good!

🧪 Compilation Tests

Passed - All code compiles successfully!

📋 Overall Status

🎉 Ready for Review - Your PR has passed all automated checks!
👥 Maintainers have been notified for review.


This comment was generated automatically. Checks will re-run when you push new commits.

@github-actions
Copy link

github-actions bot commented Oct 1, 2025

🎉 Welcome to Hacktoberfest 2025, @JitinSaxenaa! 🎃

Thank you for your first contribution to our DSA repository! Here's what happens next:

🔍 Automatic Checks

  • Code Validation: Passed
  • 🧪 Compilation Tests: Passed

📋 Next Steps

🎯 Great job! Your code compiled successfully. Maintainers @Karanjot786 and @Pradeepsingh61 will review your PR soon.

🎁 What You Get

  • 🏆 Hacktoberfest Credit: This PR counts toward your 6 PR goal for exclusive T-shirt + Tree!
  • 🌟 Hall of Fame: You'll be featured in our contributors list
  • 📚 Learning: Code review feedback from experienced developers

💡 Tips for Success

  • Follow our Contributing Guidelines
  • Add comments explaining your algorithm
  • Include time/space complexity analysis
  • Test your code before submitting

Welcome to the community! 🚀

@github-actions
Copy link

github-actions bot commented Oct 1, 2025

🤖 Automated PR Status

🔍 Code Validation

Passed - File naming and structure look good!

🧪 Compilation Tests

Passed - All code compiles successfully!

📋 Overall Status

🎉 Ready for Review - Your PR has passed all automated checks!
👥 Maintainers have been notified for review.


This comment was generated automatically. Checks will re-run when you push new commits.

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.

3 participants