提要:大部分会用英文术语,因为在美本读CS。本文自我成长,欢迎大家讨论。
知识大纲:
- Depth-First-Search
- Directed Graph/Undirected Graph
- Directed Acyclic Graph (DAG)
- Topological Sorting
- Meta-Graph: Algorithm of constructing
- Breadth-First-Search
- Dijkstra's Shortest Path
- Minimium Spinning Tree
- Kruskal's Greedy Algorithm
- Union-Find data Structure
- Prim's Algorithm
今日题一:Leetcode 101 对称二叉树 Symmetric Tree
Method: Using breath-first search.(kind of?)数学归纳法思想。
大致思路:从root往下search,depth加深,如果到目前depth依旧是对称,那这一层上所有的node的children应该也要对称,以此为目标构建helper function。
/**
* Definition for a binary tree node.
* public class TreeNode {
* i