1
0
Fork 0
Obsidian 管理的个人笔记仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

321 B

深度优先遍历: DFS(英语:Depth-First-Search,DFS) 是一种用于遍历或搜索树或图的算法

const node = {
	name: "node 1",
	children: []
};

function DFS(node) {
	console.log("探寻", node.name);
	node.children.forEach(child => {
		DFS(child);
	});
	console.log("回溯", node.name);
}