[LeetCode] questions conclustion_BFS, DFS

BFS, DFS 的题目总结. 

Directed graph:

Directed Graph Loop detection and if not have, path to print all path.

 

BFS/DFS: (可以用BFS或者DFS的,主要还是遍历)

 [LeetCode] 733. Flood Fill_Easy tag: BFS     1

[LeetCode] 690. Employee Importance_Easy tag: BFS    1

[LeetCode] 529. Minesweeper_ Medium_ tag: BFS

[LeetCode] 200. Number of Islands_ Medium tag: BFS

[LeetCode] 133. Clone Graph_ Medium tag: BFS, DFS

[LeetCode] 261. Graph Valid Tree _ Medium tag: BFS

[LeetCode] 301. Remove Invalid Parentheses_Hard tag:BFS

[LeetCode] 104. Maximum Depth of Binary Tree_Easy tag: DFS

[LeetCode] 827. Making A Large Island

[LeetCode] 695. Max Area of Island_Easy tag: DFS/BFS

[LeetCode] 490. The Maze_Medium tag: BFS/DFS

 [LeetCode] 130. Surrounded Regions_Medium tag: DFS

 

 

BFS(shortest path/distance, level traversal)

  • level traversal
  • one node to all other nodes in graph
  • 图上两点之间最短距离

[Leetcode] 863. All Nodes Distance K in Binary Tree_ Medium tag: BFS, Amazon     1

[LeetCode] 199. Binary Tree Right Side View_ Medium tag: BFS, Amazon

[LeetCode] 102. Binary Tree Level Order Traversal_Medium tag: BFS

[LeetCode] 429. N-ary Tree Level Order Traversal_ Easy

[LeetCode] 127. Word Ladder _Medium tag: BFS

[LeetCode] 675. Cut Off Trees for Golf Event_Hard tag: BFS

[LeetCode] 103. Binary Tree Zigzag Level Order Traversal _ Medium tag: BFS

[LeetCode] 101. Symmetric Tree_ Easy tag: BFS

[LeetCode] 513. Find Bottom Left Tree Value_ Medium tag: BFS

[LeetCode] 286. Walls and Gates_Medium tag: BFS

[LeetCode] 116&117. Populating Next Right Pointers in Each Node I&II_Medium tag: BFS(Dont know why leetcode tag it as DFS...)

[LeetCode] 310. Minimum Height Trees_Medium tag: BFS

 

 

DFS

[LeetCode] 207 Course Schedule_Medium tag: BFS, DFS    1 

[LeetCode] 785. Is Graph Bipartite?_Medium tag: DFS, BFS

[LeetCode] 210. Course Schedule II

[LeetCode] 694. Number of Distinct Islands

[LeetCode] 711. Number of Distinct Islands II_hard tag: DFS

[LeetCode] 851. Loud and Rich_ Medium tag: DFS

[LeetCode] 112. Path Sum_Easy tag: DFS

[LeetCode] 114. Flatten Binary Tree to Linked List_Medium tag: DFS

[LeetCode] 257. Binary Tree Paths_ Easy tag: DFS

[LeetCode] 113. Path Sum II

[LeetCode] 437. Path Sum III_ Easy tag: DFS

[LeetCode] 124. Binary Tree Maximum Path Sum_ Hard tag: DFS recursive

[LeetCode] 687. Longest Univalue Path_Easy tag: DFS recursive

[LeetCode] 298. Binary Tree Longest Consecutive Sequence_Medium tag: DFS recursive

[LeetCode] 549. Binary Tree Longest Consecutive Sequence II_ Medium tag: DFS recursive

[LeetCode] 721. Accounts Merge_Medium tag: DFS recursive

[LeetCode] 111. Minimum Depth of Binary Tree_Easy tag:DFS

 [LeetCode] 110. Balanced Binary Tree_Easy tag: DFS

[LeetCode] 100. Same Tree_Easy tag: DFS

[LeetCode] 99. Recover Binary Search Tree

[LeetCode] 129. Sum Root to Leaf Numbers_Medium tag: DFS

[LeetCode] 559. Maximum Depth of N-ary Tree_Easy tag: DFS

 

BFS & DFS

[LeetCode] 126. Word Ladder II_Hard tag: BFS&DFS

转载于:https://www.cnblogs.com/Johnsonxiong/p/9321286.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值