Skip to content

add 4 files with queen problem solution and complexity.md with comments#1

Open
dfdf11-cpu wants to merge 1 commit intomainfrom
queens
Open

add 4 files with queen problem solution and complexity.md with comments#1
dfdf11-cpu wants to merge 1 commit intomainfrom
queens

Conversation

@dfdf11-cpu
Copy link
Owner

это домашнее задание про расстановку ферзей.
в файле queen_pereborka.py - переборное решение;
в файле queen_recursion.py - рекурсивное решение;
в файле queen_fast.py - самое быстрое решение;
в файле complexity.md - описание сложности данных решений.

@dfdf11-cpu dfdf11-cpu requested a review from chernishev October 11, 2025 10:04
Copy link

@Godrik0 Godrik0 left a comment

Choose a reason for hiding this comment

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

Решения хорошие, особо проблем нет.
Добавьте, пожалуйста комментарии к сложной логике, и было бы прекрасно, если бы добавили документацию к функциям PEP 257.

Comment on lines +7 to +15
available = ((1 << n) - 1) & ~(columns | d1 | d2)

while available:
position = available & -available
available -= position

count += solve(
row + 1, columns | position, (d1 | position) << 1, (d2 | position) >> 1
)
Copy link

Choose a reason for hiding this comment

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

Для такой сложной логики обязательно нужны комментарии с пояснениями

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