F_G

许多问题需要说清楚就可以&&走永远比跑来的重要

导航

上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 23 下一页

2015年8月18日 #

[Leetcode] Count Complete Tree Nodes

摘要: Count Complete Tree NodesGiven acompletebinary tree, count the number of nodes.Definition of a complete binary tree fromWikipedia:In a complete binary... 阅读全文

posted @ 2015-08-18 20:19 F_G 阅读(163) 评论(0) 推荐(0) 编辑

[Leetcode] Linked List Cycle II

摘要: 如何找到环的起始位置?算法大家估计都已经是耳熟能详了,关键是证明。我们假设从起始位置到环的起点的长度为X,相遇位置离起始点的距离为K,环的长度为Y,由于fast pointer的速度是low pointer的两倍。所以X+mY+K=2*(X+nY+K)X+K=(m-2n)Y从这个等式可以解释为什么:... 阅读全文

posted @ 2015-08-18 09:15 F_G 阅读(115) 评论(0) 推荐(0) 编辑

[Leetcode] Single Number II

摘要: 参考当中有对一个bug的说明[1] http://shmilyaw-hotmail-com.iteye.com/blog/2153924 阅读全文

posted @ 2015-08-18 08:34 F_G 阅读(101) 评论(0) 推荐(0) 编辑

2015年8月17日 #

[Leetcode] Surrounded Regions

摘要: 使用DFS可能会溢出,所以使用BFS比较保险。对于矩阵的位置如何保存,刚开始我想到使用创建class node来保存横纵坐标,当发现参考文献【1】的时候,才发现,只需要一个整数值,就可以了。position = rowindex*col + colindex;如要得到相应的横纵坐标,使用相反的取模等... 阅读全文

posted @ 2015-08-17 20:29 F_G 阅读(111) 评论(0) 推荐(0) 编辑

[算法] 字符串压缩

摘要: 参考[1] http://www.cnblogs.com/venow/archive/2012/09/03/2668454.html[2] http://blog.csdn.net/fivedoumi/article/details/7961835 阅读全文

posted @ 2015-08-17 19:36 F_G 阅读(219) 评论(0) 推荐(0) 编辑

[算法] 坏的问题

摘要: 一、链表中存在坏,找出坏的开始位置二、找出N个元素当中的一个重复元素,取值范围为 [1,N-1]参考 阅读全文

posted @ 2015-08-17 19:31 F_G 阅读(130) 评论(0) 推荐(0) 编辑

[算法]二叉树的序列化、反序列化

摘要: 一、 使用先序遍历的方式【1】中的方式是采用设定#的方式,当访问读取了#时候,创建null,返回。二、二叉搜索树的序列化二叉搜索树具有的有序的性质,可以利用这个性质来递归的反序列化BST对当前节点要处理的数据的范围设定一个边界,当读取的值是在这个范围里面的时候,则进行node的创建,否则创建NULL... 阅读全文

posted @ 2015-08-17 19:04 F_G 阅读(152) 评论(0) 推荐(0) 编辑

[底层] 大端小端

摘要: 参考[1] http://blog.csdn.net/zhaoshuzhaoshu/article/details/37600857/ 阅读全文

posted @ 2015-08-17 16:43 F_G 阅读(125) 评论(0) 推荐(0) 编辑

sort算法总结

摘要: sort算法总结冒泡排序,插入排序,选择排序,heap 排序,fast 排序等等 阅读全文

posted @ 2015-08-17 15:30 F_G 阅读(198) 评论(0) 推荐(0) 编辑

[Leetcode] Longest Consecutive Sequence

摘要: Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given[100, 4, 200, 1, 3, 2],The longest ... 阅读全文

posted @ 2015-08-17 15:29 F_G 阅读(133) 评论(0) 推荐(0) 编辑

上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 23 下一页