feat: add the section of Graph Traversal (#367)
* Graph dev * Add the section of Graph Traversal. * Add missing Vertex.java * Add mkdocs.yml * Update numbering * Fix indentation and update array.mdpull/381/head
@ -0,0 +1,35 @@
|
||||
/**
|
||||
* File: TreeNode.java
|
||||
* Created Time: 2022-11-25
|
||||
* Author: Krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
package include;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/* 顶点类 */
|
||||
public class Vertex {
|
||||
public int val;
|
||||
public Vertex(int val) {
|
||||
this.val = val;
|
||||
}
|
||||
|
||||
/* 输入值列表 vals ,返回顶点列表 vets */
|
||||
public static Vertex[] valsToVets(int[] vals) {
|
||||
Vertex[] vets = new Vertex[vals.length];
|
||||
for (int i = 0; i < vals.length; i++) {
|
||||
vets[i] = new Vertex(vals[i]);
|
||||
}
|
||||
return vets;
|
||||
}
|
||||
|
||||
/* 输入顶点列表 vets ,返回值列表 vals */
|
||||
public static List<Integer> vetsToVals(List<Vertex> vets) {
|
||||
List<Integer> vals = new ArrayList<>();
|
||||
for (Vertex vet : vets) {
|
||||
vals.add(vet.val);
|
||||
}
|
||||
return vals;
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 75 KiB |
After Width: | Height: | Size: 64 KiB |
After Width: | Height: | Size: 104 KiB |
After Width: | Height: | Size: 83 KiB |
After Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 95 KiB |
After Width: | Height: | Size: 97 KiB |
After Width: | Height: | Size: 102 KiB |
After Width: | Height: | Size: 102 KiB |
After Width: | Height: | Size: 102 KiB |
After Width: | Height: | Size: 105 KiB |
After Width: | Height: | Size: 105 KiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 102 KiB |
After Width: | Height: | Size: 65 KiB |
After Width: | Height: | Size: 68 KiB |
After Width: | Height: | Size: 71 KiB |
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 78 KiB |
After Width: | Height: | Size: 77 KiB |
After Width: | Height: | Size: 84 KiB |
After Width: | Height: | Size: 99 KiB |