Skip to content

Latest commit

 

History

History
63 lines (51 loc) · 812 Bytes

Ex_4_1_03.md

File metadata and controls

63 lines (51 loc) · 812 Bytes
title date draft tags categories
Algorithm4 Java Solution 4.1.03
2020-01-28 06:59:15 +0800
false
JAVA
TECH
archives

4.1.03

Problem:

4.1.3 Create a copy constructor for Graph that takes as input a graph G and creates and initializes a new copy of the graph. Any changes a client makes to G should not affect the newly created graph.

Solution:

code:

Ex_4_1_03.java


-----------------------original-------------------------------
13 vertices, 13 edges
0: 6 2 1 5
1: 0
2: 0
3: 5 4
4: 5 6 3
5: 3 4 0
6: 0 4
7: 8
8: 7
9: 11 10 12
10: 9
11: 9 12
12: 11 9

-----------------------copy-------------------------------
13 vertices, 13 edges
0: 6 2 1 5
1: 0
2: 0
3: 5 4
4: 5 6 3
5: 3 4 0
6: 0 4
7: 8
8: 7
9: 11 10 12
10: 9
11: 9 12
12: 11 9