shivanshugarg12800 / Algo_GT

This is the Master Repository for all the different algorithms in the world of DSA, be it in any language C++, Java, Python etc.....
12 stars 37 forks source link

N Queen Problem #63

Closed kumarshobhit closed 3 years ago

kumarshobhit commented 3 years ago

Is your feature making a change to an existing problem/algorithm yes

If you are making changes, please describe the type of change in brief else NA N queen problem using Backtracking Concept in java language under a new folder called Recursion.

Describe in brief about what new problem/algorithm addition The idea is to place queens one by one in different columns, starting from the leftmost column. When we place a queen in a column, we check for clashes with already placed queens. In the current column, if we find a row for which there is no clash, we mark this row and column as part of the solution. If we do not find such a row due to clashes then we backtrack and return false