Course: "Programming and Data Structures"
Class: 1823
Name: Li Jinquan
Student ID: 20182335
experiments Teacher: Johnny
experiment Date: November 25, 2019
Compulsory / Elective: Compulsory
1. Experimental content
Complete the comprehensive practice chart
- (1) Initialization: The screen prompts (e.g.: input an undirected graph, the input 2 as a directed graph) Initialize a directed graph (available adjacency matrix, it can also be used adjacent table) to map and, FIG need to define (vertices number, the number of edges, it is recommended to FIG drawn on rough paper, and then enter the number of vertices and edges) (2 minutes)
- (2) FIG traversal: There is completed (depth and breadth first traversal) to traverse to view and FIG None (4 minutes)
- (3) have completed the sort topography, and outputs the output sequence or topological sort exists FIGS ring (3 min)
- (4) After the minimum spanning tree undirected graph (Kruscal Prim algorithm or algorithms may be), and output (3 points)
- (5) completion has solved (Dijkstra) (3 min) to a single-source shortest path map;
2. Experimental procedure and results
Experiment a
map creation, initialization undirected graphs and directed graphs
Experiment two
traversal completion of FIG.
Third experiment
complete topological sorting
Experiment 4
to complete the minimum spanning tree algorithm used Kruscal
Experiment 5
calculates the shortest path by Dijkstra
3. Experimental problems encountered in the process and settlement process
- One problem: When the list of FIG output can not be arranged,
- A solution to the problem: the question of amending the definition of an array
Other (perception, thinking, etc.)
The experiment takes a lot of time, usually in relatively full schedule drawn when there is no sufficient time to complete the test leads when the last post in a hurry, it will be easy to correct.