{% extends "base.html" %} {% block title %}Backtracking | USSU Algorithm Analyzer v4.0 {% if result %}

🌲 Backtracking Tree Analysis

State Space Exploration

{{ result.algorithm }} — DFS over state space with constraint checking. {{ result.recursions }} recursive calls, {{ result.comparisons }} constraint checks.

Pruning

Invalid branches pruned early via constraint validation. Reduced search space from exponential to manageable subset.

Solution

Found in {{ "%.4f"|format(result.execution_time_ms) }}ms. Complexity: {{ result.time_complexity }}.

{% endif %} {% endblock %} {% block content %}

Select Puzzle

Puzzle Info

N-Queens

O(n!) O(n²) Space

Place n queens on n×n board so no two attack each other. Classic backtracking with pruning.

Sudoku Solver

O(9^(n²)) O(n²) Space

Fill 9×9 grid so each row, column, and 3×3 box contains 1-9. Constraint satisfaction.

Hamiltonian Cycle

O((V-1)!) O(V) Space

Find cycle visiting every vertex exactly once. NP-Complete problem solved via backtracking.

{% if result %}

Result

Algorithm
{{ result.algorithm }}
Time (ms)
{{ "%.4f"|format(result.execution_time_ms) }}
Memory
{{ "%.2f"|format(result.memory_used_kb) }} KB
Recursions
{{ result.recursions }}
Comparisons
{{ result.comparisons }}
Complexity
{{ result.time_complexity }}
Time (ms)
{{ "%.4f"|format(result.execution_time_ms) }}
Recursions
{{ result.recursions }}
Comparisons
{{ result.comparisons }}
{% if result.solutions_found is defined %}Solutions Found: {{ result.solutions_found }}
{% endif %} {% if result.solved is defined %}Solved: {{ result.solved }}
{% endif %} {% if result.subsets is defined %}Subsets: {{ result.subsets }}
Count: {{ result.count }}
{% endif %} {% if result.possible is defined %}Colorable: {{ result.possible }}
Colors: {{ result.coloring }}
Colors Needed: {{ result.colors_needed }}
{% endif %} {% if result.found is defined %}Found: {{ result.found }}
Cycle: {{ result.cycle }}
{% endif %}
{% if result.first_solution is defined %}
{% for row in result.first_solution %}
{% for cell in row %}
{% if cell == 1 %}♛{% else %}·{% endif %}
{% endfor %}
{% endfor %}
{% endif %} {% if result.grid is defined %}
{% for row in result.grid %}
{% for cell in row %}
{{ cell }}
{% endfor %}
{% endfor %}
{% endif %} {% endif %} {% if result %}

🌲 Backtracking Tree Analysis

State Space Exploration

{{ result.algorithm }} — DFS over state space with constraint checking. {{ result.recursions }} recursive calls, {{ result.comparisons }} constraint checks.

Pruning

Invalid branches pruned early via constraint validation. Reduced search space from exponential to manageable subset.

Solution

Found in {{ "%.4f"|format(result.execution_time_ms) }}ms. Complexity: {{ result.time_complexity }}.

{% endif %} {% endblock %} {% block extra_scripts %} {% if result %}

🌲 Backtracking Tree Analysis

State Space Exploration

{{ result.algorithm }} — DFS over state space with constraint checking. {{ result.recursions }} recursive calls, {{ result.comparisons }} constraint checks.

Pruning

Invalid branches pruned early via constraint validation. Reduced search space from exponential to manageable subset.

Solution

Found in {{ "%.4f"|format(result.execution_time_ms) }}ms. Complexity: {{ result.time_complexity }}.

{% endif %} {% endblock %}