前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >资源 | 从算法到数据结构,百道面试问题实现答案集合

资源 | 从算法到数据结构,百道面试问题实现答案集合

作者头像
机器之心
发布2018-05-07 14:36:56
6660
发布2018-05-07 14:36:56
举报
文章被收录于专栏:机器之心机器之心

选自GitHub

作者:Sherali Obidov

机器之心编译

参与:李亚洲、微胖、蒋思源

该资源是算法、数据结构以及面试问题解决方案的集合,里面的 repository 包含了我对常见算法问题的解答以及数据结构的实现(用 Java)。该资源集合处于持续更新中。

项目地址:https://github.com/sherxon/AlgoDS

目前为止,该资源集合提供了算法、数据结构以及 200 道面试题的答案。

问题

问题被分成了三个等级:

  • 简单问题:http://suo.im/262F7q
  • 中等问题:http://suo.im/11JBcd
  • 困难问题:http://suo.im/3pTT1R

问题方向

针对以下不同面试问题,各自的链接中都给出了解决方案。

阵列(Arrays)

  1. 旋转阵列(Rotate Array):http://suo.im/2Z3CMz
  2. Contains Duplicate:http://suo.im/2E9xnW
  3. 发现峰值元素:http://suo.im/4gQO3k
  4. 最大化子阵列(Maximum Subarray):http://suo.im/N0TXd
  5. 阵列中第 k 最大的元素(Kth Largest Element in an Array):http://suo.im/2P7aIi
  6. 搜索阵列中的所有 Duplicates:http://suo.im/2wQwpw
  7. 最长增长子序列(Longest Increasing Subsequence):http://suo.im/PvJyK
  8. 旋转图像、矩阵(Rotate Image, matrix):http://suo.im/3BGG1x
  9. 搅乱阵列(Shuffle an Array):http://suo.im/3V5MBe
  10. 在旋转阵列中搜索最小值:http://suo.im/2xtLa0
  11. 在旋转阵列中搜索:http://suo.im/1Ued08

链表(linked list)

  1. 单链表实现:http://suo.im/2n3Kzr
  2. 双向链表实现(Doubly Linked List):http://suo.im/1y98CP
  3. 删除链表中的结点:http://suo.im/41ZByL
  4. 回文链表(Palindrome Linked List):http://suo.im/3OWugt
  5. 反向链表(Reverse Linked List):http://suo.im/OxjXQ
  6. 两个链表的交集点(Intersection of Two Linked Lists):http://suo.im/36rPzZ
  7. 链表循环:http://suo.im/gANC2
  8. 从表的底部一处 Nth 节点:http://suo.im/4D3RNj
  9. 合并分类链表(Merge Sort List):http://suo.im/4jAMx3
  10. 发现链表循环:http://suo.im/2UFfZI
  11. 合并 k 分类列表:http://suo.im/4uWyyt
  12. 其他有关列表的问题:http://suo.im/4TyiJ

二叉树(Binary Tree)

  1. 二叉树的层次遍历(Binary Tree Level Order Traversal):http://suo.im/1DRKTK
  2. 左叶节点求和(Sum of Left Leaves):http://suo.im/nZnDk
  3. 二叉树转置(Invert Binary Tree): http://suo.im/27dXUu
  4. 二叉搜索树迭代器(Binary Search Tree Iterator):http://suo.im/4EgmWR
  5. 二叉树后序遍历(Binary Tree Postorder Traversal):http://suo.im/2I6r5S
  6. 二叉树前序遍历(Binary Tree Preorder Traversal):http://suo.im/1AF5J0
  7. 平面化二叉树为链表(Flatten Binary Tree to Linked List):http://suo.im/46kRsP
  8. 对称树(Symmetric Tree):http://suo.im/BnxLJ
  9. 二叉树中序遍历(Binary Tree Inorder Traversal):http://suo.im/snOMr
  10. 相似树(Same Tree):http://suo.im/1OCC7W
  11. 二叉树最大深度(Maximum Depth of Binary Tree):http://suo.im/2KinyW
  12. 平衡二叉树(Balanced Binary Tree):http://suo.im/3goksD
  13. 二叉树最小深度(Minimum Depth of Binary Tree):http://suo.im/2f53cs
  14. 平衡二叉搜索树排序列表(Sorted List to Balanced Binary Search Tree):http://suo.im/2D1MAo
  15. 验证二叉搜索树(Validate Binary Search Tree):http://suo.im/1lkBnt
  16. 平衡搜索树排序列表(Sorted List to Balanced BST):http://suo.im/2Qr9IL
  17. 平衡搜索树第 k 最小元素(Kth Smallest Element in a BST):http://suo.im/4mwq7K
  18. 二叉树的之字形层序遍历(Binary Tree Zigzag Level Order Traversal):http://suo.im/3NCvZW
  19. 平衡搜索树的结点删除(Delete Node in a BST):http://suo.im/1cXcP3
  20. 平衡树的最小公共祖先(Lowest Common Ancestor of BST):http://suo.im/MBljD
  21. 二叉树的左视图(Binary Tree Left Side View):http://suo.im/1hzBvx
  22. 二叉树的右视图(Binary Tree Right Side View):http://suo.im/2Invga
  23. 平衡搜索树的众数(Mode in BST):http://suo.im/3Jyrn2
  24. 最高频率子树和(Most Frequent Subtree Sum):http://suo.im/35LlcZ
  25. 搜寻每行最大元素(Find Largest Element in Each Row):http://suo.im/32twya

其他树型问题:http://suo.im/4TyiJ

数学

  1. 整数拆分(Integer Break):http://suo.im/lJU8r
  2. 逆位(Reverse Bits):http://suo.im/2E075a
  3. 回文数:(Palindrome Number):http://suo.im/3pkhnt
  4. 幂(Math.pow):http://suo.im/1Wr3E9
  5. 壶和水的问题(Jug and Water Problem):http://suo.im/1gWPQG
  6. 爱拉托逊新筛法(Sieve of Eratosthenes):http://suo.im/Pi0G7
  7. 费马素数(Fermat's primality):http://suo.im/2HZFT3
  8. 评估逆波兰式表示法(Evaluate Reverse Polish Notation):http://suo.im/jIGg6

堆栈&队列(Stack & Queue)

  1. 最小堆栈:http://suo.im/4FiVlB
  2. 最小队列:http://suo.im/3KEtsq
  3. 使用队列实现堆栈:http://suo.im/D5r2s
  4. 使用堆栈实现队列:http://suo.im/171IwF

动态编程(Dynamic Programming)

  1. 斐波那契数列:http://suo.im/1zjJhk
  2. 词内换行(word break):http://suo.im/3BIxnZ
  3. 子集和:http://suo.im/abSSP
  4. 0/1 渐缩问题:http://suo.im/1gVbIL
  5. 最短回文(KMP):http://suo.im/362qXW

MISC

  1. 并查:http://suo.im/24ZJmj
  2. 排列:http://suo.im/2NZx1s
  3. 子集:http://suo.im/PgGSw

算法方向

排序与搜索(Sorting And Searching)

  1. 上推排序:http://suo.im/2ofoaz
  2. 插入排序:http://suo.im/2unWJM
  3. 选择排序:http://suo.im/2Sqldb
  4. 计算排序:http://suo.im/ZsIt7
  5. 二叉搜索,上下界:http://suo.im/10C1jM
  6. 归并排序:http://suo.im/1iBDRS
  7. 快速排序:http://suo.im/1ZV7sc

图(Graphs)

  1. 宽度优先搜索(BFS):http://suo.im/2GhGd8
  2. 深度优先搜索(DFS):http://suo.im/1xuHah
  3. Prim 最小生成树(MST):http://suo.im/34Ignu
  4. KrusKal 最小生成树(MST):无
  5. 拓扑排序:http://suo.im/2KxOO
  6. 最短路径的戴克斯特拉算法(Dijsktra):http://suo.im/3uv4kJ
  7. 最短路径的 Bellman-Ford 算法:http://suo.im/2HgD4k
  8. 启发式路径搜索(Heuristic Path Finding):http://suo.im/2pQoF6
  9. 二分图:http://suo.im/29I5J1

字符串(String)

  1. Rabin Karp 序列搜索:http://suo.im/3dUjZM
  2. Ransom Note:http://suo.im/2fIVZc
  3. 逆字符串(Reverse String):http://suo.im/355a41
  4. 最长公共前缀(Longest Common Prefix):http://suo.im/1gt97D
  5. Is 易位构词(Anagram):http://suo.im/3BWyAQ
  6. Needle and Haystack:http://suo.im/lXoT4
  7. 词内换行(word break):http://suo.im/3BIxnZ

数据结构

树(Trees)

  1. 二叉搜索树(递归):http://suo.im/2I4nfe
  2. 二叉搜索树(迭代):http://suo.im/1M2Q6Z
  3. AVL 树:http://suo.im/151lYW
  4. Trie(Prefix 树):http://suo.im/2evIeJ

本文为机器之心编译,转载请联系本公众号获得授权。

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2017-04-09,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 机器之心 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档