Topic 1: Preliminary use of Recursion
For more information about recursion, see here.
Recursive applications are always associated with deep-priority searches. First, read two related articles, one in Chinese and one in English.
After reading these two articles, we should have some knowledge about the basic concepts of deep priority. Please use the sample program to carefully understand the solution to the Queen's problem. This is a classic issue of deep priority search.
The following is an example of the problem:
Integer splitting
Combination Problem
Full Arrangement
Eight queens
If there is any difficulty in understanding these procedures, we will explain them in detail. After understanding it, edit it again.
Below are some exercises about them.
We will continue to add many questions in this regard.
Group Z1: initial recursive and deep Priority Search
Group 11: Initial Search
Deep preference search and breadth preference search are common search technologies. The former uses recursion, and the latter involves queues.
Deep priority search is not necessarily the best solution to some problems, but it is easy to implement and sometimes very effective. Its difficulty lies in how to optimize pruning. The questions that appear in the recursion preliminary can be considered as a deep search.
The structure of the breadth-first search technology is relatively fixed, but it is also difficult to judge the node. Because of the time efficiency, extended search is more widely used.
Below are some exercises about them.
No. Source question title
11.0 ZJU 2416 Open the Lock
Breadth is preferred. (Sample program)
11.1 ZJU 1091 Knight Moves has the simplest breadth-first search problem, but includes all elements of this type of method.
11.2 ZJU 1005 Jugs typical breadth-first
11.3 application of ZJU 1649 Rescue breadth first in maze Problems
11.4 ZJU 1002 Fire Net is applicable to deep-priority questions. Some require good pruning.
11.5 ZJU 1003 Crashing Balloon
11.6 ZJU 1004 Anagrams by Stack
Group 13: breadth-first search
Below are some exercises about breadth-first search (BFS.
No. Source question title
13.0 ZJU 1438 Asteroids! 3D maze, think about how to control the direction
13.1 ZJU 2050 Flip Game can try bit operations
13.2 ZJU 2081 Mission Impossible can be used with BFS + DFS
13.3 ZJU 1310 Robot advanced, slightly more difficult
13.4 ZJU 1671 Walking Ant
13.5 ZJU 1940
Dungeon Master
13.6 ZJU 1103 Hike on a Graph
13.7 ZJU 1358 Moving Object Recognition
13.8 ZJU 1217 Eight problem. Note the State representation and hash.
13.9 ZJU 1227 Free Candies
13.10 ZJU 1505 Solitaire
13.11 ZJU 1361 Holedox Moving
Group 12: Deep Priority Search
The following are some exercises about deep Priority Search (DFS.
No. Source question title
12.0 PKU 1256 ansible
Generate non-repeated sorting
12.1 ZJU 1711 Sum It Up to generate duplicate combinations
12.2 ZJU 2412 Farm Irrigation preliminary, some need pruning
12.3 ZJU 1694 Shredding Company
12.4 ZJU 1457 Prime Ring Problem
12.5 ZJU 1204 Additive equations
12.6 ZJU 2192 T-shirt Gumbo advanced, ordered search and Pruning
12.7 ZJU 1909 Square
12.8 ZJU 1987 Vase Collection
12.9 ZJU 1937 Addition Chains
12.10 ZJU 1984 Genetic Code
12.11 ZJU 2110 Tempter of the Bone
12.12 ZJU 1179 Finding Rectangles problems require good search strategies and pruning Techniques
12.13 ZJU 1411 Anniversary
12.14 ZJU 1008 Gnome Tetravex
12.15 ZJU 1499 Increasing Sequences
Group 14: Graph Traversal and Transitive Closure)
No. Source question title
14.0 ZJU 1221 Risk using BFS can also solve the shortest path problem
14.1 ZJU 2165 Red and Black grid-based connectivity analysis
14.2 ZJU 1589 extends sor John to pass the closure, you can also use DFS
14.3 ZJU 1085 Alien Security
Group 15: Graph-topologysort and Articulation Point)
No. Source question title
15.0 ZJU 1060 Sorting It All Out
15.1 ZJU 1119 SPF
15.2 ZJU 1311 Network
Group 16: Graph -- Minimum Spanning Tree)
No. Source question title
16.0 ZJU 1406 Jungle Roads
16.1 ZJU 1203 Swordfish
16.2 ZJU 1542 Network
16.3 ZJU 1586 QS Network node weight
16.4 ZJU 1372 Networking
16.5 ZJU 1914 Arctic Network think about why the minimum spanning tree can be used?
16.6 ZJU 2158 Truck History think about how to convert it into a minimal spanning tree?
16.7 ZJU 2048 High Ways least spanning tree based on connected components
16.8 ZJU 1718 Building a Space Station
16.9 PKU 1258 Agri-Net
Group 17: Figure -- Shortest Path)
No. Source question title
17.0 ZJU 1053 FDNY to the Rescue!
17.1 ZJU 1609 Equivalence
17.2 ZJU 1082 Stockbroker Grapevine
17.3 ZJU 1655 Transport Goods edge weight is somewhat special
17.4 ZJU 1092 Arbitrage
17.5 ZJU 1967 Fiber Network think about how to use the Floyd triple loop?
17.6 ZJU 1456 Minimum Transport Cost
17.7 ZJU 2008 Invitation Cards Dijkstra with minimal heap
17.8 ZJU 1765 Which Way Do I Go? Complex Questions
17.9 ZJU 1232 Adventure of Super Mario
Group 18: figure-circuit problem (Euler Path & Hamilton Tour)
No. Source question title
18.0 ZJU 1105 FatMouse's Tour
18.1 ZJU 2016 Play on Words can be converted to determining the existence of Euler's path
18.2 ZJU 1130 Ouroboros Snake can be converted to Euler's path
18.3 SCU 1286 First Love can be converted to Euler's path
Group 19: Graph-two-part graph Matching (Bipartite Matching)
No. Source question title
19.0 ZJU 1140 Courses
19.1 ZJU 1137 Girls and Boys
19.2 ZJU 1157 A Plug for UNIX
19.3 ZJU 1364 Machine Schedule
19.4 ZJU 1197 Sorting Slides
19.5 ZJU 1525 Air Raid
19.6 ZJU 1059 What's In a Name
19.7 ZJU 1516 Uncle Tom's Inherited Land
19.8 ZJU 1654 Place the Robots
19.9 ZJU 1509 Family
Group 20: figure-Network Flow)
No. Source question title
20.0 PKU 1273 Drainage Ditches typical maximum network flow
20.1 ZJU 1734 Power Network can be converted to the maximum Network flow
Group 21: Graph -- Difference constraint (Difference Constraints)
No. Source question title
21.0 ZJU 1260 King
21.1 ZJU 1420 Cashier employee
21.2 ZJU 1455 Schedule Problem
21.3 ZJU 1508 Intervals
Group 22: Graph -- others
No. Source question title
22.0 ZJU 1015 Fishing Net string chart Determination
22.1 ZJU 1492 Maximum Clique
Find the largest group, classic NP hard
22.2 ZJU 1576 Marriage is Stable Marriage, latency Recognition Algorithm