Search (part of the real problem)

Crop hybridization Title Description Crop hybridization is an important step in crop cultivation. There are ^ crops (numbered ^ 1 ^ to ^ n) known, and the time from sowing to maturity of ^ i ^ crop is ^ Ti. Crops can be hybridized in pairs, and the longer of the two kinds of time is taken as the hybridization time. If the planting time ...

Posted by influx on Wed, 09 Mar 2022 08:53:51 +0100

NC14608 after and maze bfs

After's algorithm book is left in a maze called AIJ. This maze has N*M rooms, the entrance of the maze is (1, 1), and the algorithm book is left in (r, c). The rooms in the maze have four states: empty rooms, inaccessible rooms, rooms with Mephisto and rooms with Lilith. Mephisto will deny everything, and Lilith will tempt people to do an activ ...

Posted by Liodel on Wed, 02 Mar 2022 13:38:19 +0100

Breadth first search depth first search dynamic programming LeetCode topic: transmitting information

original text https://lwebapp.com/zh/post/l...problemChild A is playing A message passing game with his friends. The rules of the game are as follows:There are n players. All players are numbered 0 ~ n-1 respectively, of which the number of child A is 0Each player has A fixed number of other players who can transmit information (or not). The re ...

Posted by koglakci on Tue, 01 Mar 2022 08:20:37 +0100

Share two common search algorithms: BFS and DFS

This article is shared from Huawei cloud community< Preliminary study on BFS and DFS algorithms >, author: ayin. This time I share two common search algorithms 1.BFS is breadth first search 2.DFS is depth first search Number of islands Given a two-dimensional grid consisting of '1' (land) and '0' (water), calculate the number of island ...

Posted by Roble on Mon, 28 Feb 2022 02:19:13 +0100

[ybt gold navigation 3-5-5] [luogu P1262] spy network

Spy network Title Link: ybt gold navigation 3-5-5 / luogu P1262 General idea of the topic There are some people, some of them, you can catch them, and then there is a fee. Then after a person is caught, he can help you catch some people. Ask if you can catch everyone with the minimum cost. If you can output the minimum cost, otherwise output ...

Posted by rage123456 on Fri, 11 Feb 2022 19:33:25 +0100

Save Private Ryan (P4011 Island Rescue problem) (bfs + state compression)

Title Description In 1944, special forces Mike received an order from the Ministry of defense to rush to an isolated island in the Pacific Ocean to rescue Private Ryan captured by the enemy. Ryan was imprisoned in a maze with complex terrain, but fortunately Mike got the topographic map of the maze. The shape of the maze is a rectangle. Its nor ...

Posted by purtip3154 on Mon, 07 Feb 2022 10:21:40 +0100

Graph theory search: how to use multi-source BFS to reduce time complexity

In graph theory search, single source BFS and multi-source BFS search distance. 1. BFS graph theory search question in leetcode leetcode link: 1162. Map analysis You now have a grid with a size of n x n, and each cell on it is marked with 0 and 1. Where 0 represents the ocean and 1 represents the land. Please find an ocean cell. The dist ...

Posted by rich11 on Tue, 01 Feb 2022 18:56:12 +0100

Data structure and algorithm: Fig

chart 1, Figure basic introduction 1. Why is there a map We learned linear tables and trees earlierThe linear table is limited to the relationship between a direct precursor and a direct successorThe tree can only have one direct precursor, that is, the parent nodeWhen we need to represent many to many relationships, we use graphs here. 2. ...

Posted by switchdoc on Wed, 19 Jan 2022 13:53:26 +0100

Breadth first search (BFS) and depth first search (DFS)

      1, Depth first search (BFS) 1. Introduction   BFS, its full English name is bread first search. BFS does not use rule of thumb algorithms. From the point of view of the algorithm, all child nodes obtained by expanding nodes will be added to a first in first out queue. In general experiments, the nodes whose neighbor nodes hav ...

Posted by wing_zero on Wed, 05 Jan 2022 16:46:51 +0100

Sword finger offer: motion range of JZ66 robot

describe There is a grid of rows and cols columns on the ground. The coordinates are from [0,0] to [rows-1,cols-1]. A robot starts to move from the grid with coordinates 0,0. Each time, it can only move one grid in the left, right, upper and lower directions, but it cannot enter the grid where the sum of digits of row coordinates and column co ...

Posted by rweston002 on Sun, 26 Dec 2021 12:47:12 +0100