![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Algorithms
文章平均质量分 67
我是超级马里奥
在校研究生一枚
展开
-
All Nodes Distance K in Binary Tree
首先建立无向图,然后进行广度优先搜索 def distanceK(self, root, target, K): """ :type root: TreeNode :type target: TreeNode :type K: int :rtype: List[int] """ con...原创 2018-07-23 19:31:13 · 184 阅读 · 0 评论 -
排序算法 python实现
算法详细过程参考:https://www.cnblogs.com/onepixel/articles/7674659.html 1.冒泡排序:每次交换相邻的两个元素,大的放到后面,这样一次遍历后最大元素会放到队尾。 def bubble(array): for i in range(len(array)): for j in range(1,len(array)-i):...原创 2018-07-25 16:59:34 · 159 阅读 · 0 评论 -
剑指offer总结(一)
替换空格 python解法:使用join函数可以将列表转换为字符串 class Solution: # s 源字符串 def replaceSpace(self, s): # write code here result=[] for char in s: if char==" ": ...原创 2018-07-22 21:05:12 · 96 阅读 · 0 评论