Skip to content

Added N-Queens Problem#10

Merged
cutenti merged 1 commit intomainfrom
4_complexity_of_algorithms
Dec 11, 2025
Merged

Added N-Queens Problem#10
cutenti merged 1 commit intomainfrom
4_complexity_of_algorithms

Conversation

@cutenti
Copy link
Owner

@cutenti cutenti commented Dec 10, 2025

No description provided.

Comment on lines +10 to +16
available = ((1 << n) - 1) & ~(cols | diag1 | diag2)

while available:
pos = available & -available
available -= pos

solve(row + 1, cols | pos, (diag1 | pos) << 1, (diag2 | pos) >> 1)
Copy link

Choose a reason for hiding this comment

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

Хотелось бы видеть комментарии, поясняющие эту сложную логику.
Битовые операции достаточно тяжело воспринимать вот так, остается только догадываться или вручную вычислять что же делает каждая из них.

@cutenti cutenti merged commit 23b6a31 into main Dec 11, 2025
2 checks passed
@cutenti cutenti deleted the 4_complexity_of_algorithms branch December 13, 2025 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants