Path Finding - 8-Puzzle Problem

Hash and BFS

2023/01/27 · Allen Wu

UVa 12166 Equilibrium Mobile

AI Translated from Chinese Problem: Luogu UVa 12166 Problem Statement Given a binary tree with depth not exceeding 16, representing a balance scale. Each rod is hung in the center, and the weight of each counterweight is known. What is the minimum number of counterweight weights that need to be modified to balance the scale? — Liu Rujia “Algorithm Competition Introduction Basics” Analysis At first glance, it seems difficult to start with. We can first study what properties a balanced scale has. ...

2023/01/12 · Allen Wu

UVa 1600 Patrol Robot

AI Translated from Chinese Problem: Luogu UVa439 Problem Statement Input an m*n matrix representing a map, where 1 represents obstacles and 0 represents free space. The robot needs to move from (1,1) to (m,n) on the m*n map. Each move can go one cell in one of the four directions (up, down, left, right), and can consecutively cross at most k obstacles. Data satisfies 1 <= m, n <= 20, 0 <= k <= 20. ...

2023/01/11 · Allen Wu

UVa 439 Knight Moves

AI Translated from Chinese First time writing a solution ~ Simple, but got stuck for a while. Finally realized I forgot to zero the array XD Problem: Luogu UVa439 Problem Statement Input two coordinates on an 8×8 chessboard (start and end points. Column: ah, Row: 18). Find the minimum number of moves a Knight needs to get from start to end. Analysis Typical BFS shortest path problem. 2D array id[10][10] stores the step count after taking one more step from this cell. Queues qx, qy store coordinates. ...

2023/01/09 · Allen Wu

The Organic Combination of Generation and Testing - Backtracking

Reducing unnecessary enumeration

2022/12/03 · Allen Wu

The Beauty of Data Structures - Binary Tree

Everything looks like a binary tree lately (

2022/11/06 · Allen Wu

First Look at Data Structures - Stack

Simple yet not so simple

2022/10/30 · Allen Wu