Classic data structure topic

xiaoxiao2021-03-06  74

One. In the chess board, I realize the Master Traversal Problem: In a chess of 8 * 8 square chess, from any piece of checkerboard, let the procedure rules (L-way way to walk) All checkered, each square is taken once, the test design is implemented. Description: (1) Designing the algorithm based on the JCWARNSDORFF rule. This rule is in all jumped squares, the horse is only likely to walk such a party. : From this checker, the number of squares can jump is the least; if the number of checkers can be jumped, the square sequence is small priority. (2) Use two one-dimensional array MOVEI (1: 8) and MOVEJ (1: 8) to store the displacement amount in 8 directions, see the table below. The horses on the (i, j) checkered (i Movei (P), J Movej (P)) Checkered (P = 1, ..., 8). Direction 1 2 3 4 5 6 7 8MOVEI-2 -1 1 2 2 1 -1 -2Movej 1 2 2 1 -1 -2 -2 -1 Simulate a book management system problem Description: Design a book management system, each book (book of the same book) is stored in the system: book name, bookmark number (only one number of each book), author name, The number of existing volumes and the current borrist name, requires the following functions: (1) ANG book (2) Delete the Old Secret (3) Search for Bibliographic No., author name, existing book, and current borrowers. Requirements (1) The data is stored in a certain order (2) to implement (3) selecting a convenient saving data structure to save data three. Constructing 01 string gives seven integers n, a, b, l, c, d, m; requires designing a 01 string S = S (1) S (2) ^ s (n) satisfying: 1. S (i) = 0 or S (i) = 1, 1 <= i <= n; 2. For substrs S (J) s (J 1) s (j 1) s (j 1) of S (J L-1), (1 <= j <= n-L 1), and 0 is greater than Equivalent to A and is less than or equal to B; 3. For substrs S (J) S (J 1) s (J 1) s (J 1) s (J 1), (1), (1 <= j <= n-m 1), and the number of 0 is greater than Equal to C and less than or equal to D; list, n = 6, a = 1, b = 2, L = 3, C = 1, D = 1, M = 2, there is a 01 string S = to satisfy all of the above conditions 010101. IV. Declaising whether the family spectrum is correct: the first line has two integers n, m; n indicates the number of people in the family of the family; (everyone in the family spectrum map has a unique number, number from 1 To n), M represents the number of connected relationship lines in the family spectrum map. The following M line use and describe the relationship between the original figure in the family spectrum diagram, assuming that the male and female relationship in the family spectrum is correct, that is, there is no middle middle Or the case of children in the middle of the two women, each line has a pair of positive integers constituent X, Y, indicating Y is X. Output: If the family spectrum is correct, the member in the Correct and family spectrum is output; otherwise the output appears The smallest number of the wrong person. The person who has errors is a person who is one of the following situations; (1) The number of parents is not 0 or 2. (2) The parents have a common ancestor, and at least one is common The descendants of the ancestors (including the fifth generation) (including the fifth generation), (3) ourselves are their ancestors, (4) Any party of his parents is another ancestor five. Routing problems In network communication, the shortest path often requires the shortest path. However, there is a problem with the shortest path transmission: if there is only one shortest path given between the two terminal points, one of the paths. When the node or link fails, the signal transmission will face interrupt hazards. Therefore, the following improvements have been made to network routing: three paths provide three paths for their choices, the first shortest path, the second shortest path And the third shortest path. Definition of the first shortest path is: given a network D = (V, E, W) that does not contain a negative loop, where V = {V1, V2, ... VN}, E is a side collection W is the right to set. Set the shortest (V1, V2) road in d. The first shortest (V1, V2) path in P1 is D is the first shortest (V1, V2) path, the second shortest path is defined as: if there is D V1, V2) path P2 satisfies the following conditions: (1) P2! = P1 (2) D does not exist in P1 in P1 in P2, so that (3) W (P1) <= W (p) <

W (p2) is called the second shortest (V1, V2) path in P2. The first shortest path is defined as: set P2 is the second shortest (V1, V2) path in D, if there is a section (V1) , V2) The path P3 satisfies the following conditions: (4) P2! = P3 (5) D does not exist in path P, which enables (6) W (P2) <= W (p)

转载请注明原文地址:https://www.9cbs.com/read-91931.html

New Post(0)