Summary of typical minimum spanning tree algorithms~

Classification of minimum spanning tree 🐖: The minimum spanning tree is generally used for undirected graphs, and directed graphs are rarely used. Method selection: Dense graph: using naive Prim algorithm Sparse graph: using Kruskal algorithm Heap optimized Prim is not commonly used! Plain Prim The general idea can be referred to Dijk ...

Posted by schme16 on Tue, 18 Jan 2022 17:59:39 +0100

CF662B Graph Coloring problem solution -- zhengjun

Title portal General idea of the topic Give you an undirected graph. Each edge in the graph is blue or red. Each time you select a point, you will reverse the color of the edge connected to the point (red turns blue and blue turns red). The scheme of finding the minimum number of steps will make the color of all edges the same. thinking ...

Posted by mevasquez on Tue, 18 Jan 2022 03:45:19 +0100

acwing 1207. Minister's travel

Long ago, the kingdom of T prospered unprecedentedly. In order to better manage the country, the Kingdom has built a large number of expressways to connect the capital and the major cities in the kingdom. In order to save money, the ministers of T country have formulated an excellent construction scheme after thinking, so that any big city ca ...

Posted by sharan on Mon, 17 Jan 2022 15:39:06 +0100

1613. Shortest path problem

Original question link I can't get in the Internet General idea of the topic On a map n ( 2 ≤ n ≤ 100 ) n(2\le ...

Posted by J4B on Fri, 14 Jan 2022 15:27:04 +0100

Graph theory Floyd algorithm and its extended application

1, AcWing 1125 Cattle travel [Title Description] Farmer John's farm has many pastoral areas, and some paths connect some specific pastoral areas. A pastoral area with all the connections is called a pasture. But for now, you can see that at least two pastoral areas are not connected. Now, John wants to add a path to the farm (note that there i ...

Posted by cjl on Wed, 12 Jan 2022 04:06:32 +0100

CF721C Journey problem solution

First of all, it can be found that this problem is actually similar to a knapsack problem on DAG. Then we have an obvious approach: set up f [ v ] [ t ] ...

Posted by prashanth on Wed, 12 Jan 2022 03:57:20 +0100

[beginner's line segment tree, this article must be right] line segment tree (single point modification and interval modification) acm winter vacation training diary 22 / 1 / 10

Segment tree Segment tree is a data structure commonly used to maintain interval information in algorithm competition. It is a basic and important data structure that an ACMer needs to master. The segment tree can realize single point modification, interval modification, interval query (interval summation, interval maximum value, minimum value ...

Posted by bnownlater on Mon, 10 Jan 2022 15:36:12 +0100

Ski Valley P2573 minimum spanning tree

Title Description a180285 likes skiing very much. He came to a snow mountain, where there are , mm , taxiing tracks and , nn , track intersections (also scenic spots), and each scenic spot has a number , i\space (1 \le i \le n)i (1 ≤ i ≤ n) and a height , h_ihi​. A180285 can slide from the scenic spot ^ ii ^ to the scenic spot ...

Posted by SheDesigns on Sat, 08 Jan 2022 07:58:45 +0100

On chain forward star

Before introducing the chain forward star, let's look at a picture: Layer 1 1 2 3 4 5 6 1 2 ...

Posted by shibiny on Sat, 08 Jan 2022 03:49:32 +0100

Shortest circuit ----- dijkstra (single source shortest circuit)

1, dijkstra algorithm The single source shortest path algorithm has the lowest complexity among the four basic shortest path algorithms, but it is not suitable for graphs with negative weight edges. Greedy thought, from the beginning to the end, a layer of ergodic graph. The shortest path from the starting point to any point can be found ...

Posted by xnowandtheworldx on Thu, 06 Jan 2022 16:05:01 +0100