注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
上一个账号因为拿不到新人考试的大米废了,不好意思,重新弄了一个账号,求大米支持~
个人总结,graph里面一共6种常见问题
一共有6种类型的问题,具体可以从leetcode的graph data stucture开始刷起。自己因为平时比较忙,第一遍学习就花了整整一个月的时间,跟lz一样的新人小白,建议多刷几遍巩固一下。
自己刷的时候又发现,Binary Tree, DP的思想很难快速吸收,所以又折回复习DP了,所以小白的话,最好从Queue,Stack, Binary Tree, Recursion, DP刷起,避免中间打断学习,在各个类型里面跳来跳去。
自己觉得第一遍刷记忆时间复杂度和空间复杂度太麻烦了,暂时没有包括,不过可能根据code里循环推到。. Χ
1. Disjoint Set - UnionFind. Χ
里面有两个变形
The find function – optimized with path compression:
Optimized by union by rank:
2. Depth First Search (DFS). Waral dи,
3. Breath First Search (BFS)
2和3最常见的问题包括1) Find if a path exists in a Graph 2)All paths from source to target
• Find the Shortest Path in Binary Matrix (BFS)
4. Minimum Spanning Tree
里面包含两种常见算法
Min Cost to Connect All Points- Kruskal's algorithm
Min Cost to Connect All Points- Prim's algorithm
5. Single Sorce Shortest Path Algorithm:
里面也有两种算法,个人比较倾向于第一种
Dijkstra's Algorithm
Bellman Ford Algoritham
6. Kahn's Algorithm with topological sorting
新人发帖,求指导,如何获得大米,感激不尽!!!. .и
|