Skip to content

hlsxx/8-puzzle-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

8-puzzle with Rust

The 8-puzzle is a classic sliding puzzle that consists of a 3x3 grid with eight numbered tiles and one empty space. The goal of the puzzle is to rearrange the tiles by sliding them into the empty space, aiming to achieve a specific configuration, typically with the numbers arranged in ascending order.

BFS

Solve with BFS and DFS algorithms

Breadth-First Search (BFS) and Depth-First Search (DFS) are two fundamental algorithms used for traversing or searching graph and tree data structures.

Example

Input matrix: 1 2 3 0 4 6 7 5 8

Breadth-First Search (BFS)

Depth: 3 Nodes count: 8

BFS

Depth-First Search (DFS)

Depth: 11 Nodes count: 12

DFS