Skip to content

Latest commit

 

History

History
31 lines (20 loc) · 1000 Bytes

README.md

File metadata and controls

31 lines (20 loc) · 1000 Bytes

8-puzzle

This is my first try at a bigger C++ project, in which I tried to use mostly self made data structures (with exceptions for the unordered set) This was just made for fun to check which of the searches finds a solution faster.

Types of searches used:

Depth first search: Very unoptimal, finds a solution in a very long time, and using many steps

Breadth first search: A good improvement sometimes over DFS but can still be unlucky and take a while to find a solution

_A search:_* Uses as heuristic the hamming distance for each square. It's very fast compared to the other 2 approaches

Implemented data structures:

Stack Implemented using a list of singly linked nodes, with constant time for every operation

Queue Same as the stack, but updated to work as it should

Priority Queue Created using a heap

An image where you can see the difference in steps taken: Outputs