菱纱梦

导航

2014年9月29日 #

Construct Binary Tree from Preorder and Inorder Traversal<leetcode>

摘要: Given preorder and inorder traversal of a tree, construct the binary tree. Note:You may assume that duplicates do not exist in the tree. 题意:知道二叉树的前序遍历 阅读全文

posted @ 2014-09-29 22:00 菱纱梦 阅读(175) 评论(0) 推荐(0) 编辑

Triangle <leetcode>

摘要: Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the fol... 阅读全文

posted @ 2014-09-29 21:26 菱纱梦 阅读(208) 评论(0) 推荐(0) 编辑

2014年9月18日 #

Jump Game <leetcode>

摘要: Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximu... 阅读全文

posted @ 2014-09-18 21:02 菱纱梦 阅读(169) 评论(0) 推荐(0) 编辑

2014年9月17日 #

C++学习笔记 <const限定词>

摘要: 1、cons可以限定一个变量,是的它的值不能被改变2、默认情况下,const对象仅在文件内有效。 编译器在编译时,会把程序中所有用到const变量的地方替换成const的初始值,因此每个用到const变量的文件中都要有const变量的定义,为了支持这一用法,同时避免同一变量的多次定义,cons... 阅读全文

posted @ 2014-09-17 21:47 菱纱梦 阅读(159) 评论(0) 推荐(0) 编辑

Search for a Range <leetcode>

摘要: Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the ord... 阅读全文

posted @ 2014-09-17 12:04 菱纱梦 阅读(150) 评论(0) 推荐(0) 编辑

Subsets <leetcode>

摘要: Given a set of distinct integers,S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not co... 阅读全文

posted @ 2014-09-17 10:44 菱纱梦 阅读(143) 评论(0) 推荐(0) 编辑

2014年9月16日 #

各种排序算法总结

摘要: 1:合并排序 合并排序算法使用分治策略实现对n个元素进行排序的算法。其基本思想是:将待排序元素分成大小大致相同的两个子集合,分别对两个子集合进行排序,最后总将排好序的子集合合并成所要求的排好序的集合。算法描述如下:void MergeSort(Typr a[],int left,int right... 阅读全文

posted @ 2014-09-16 11:27 菱纱梦 阅读(184) 评论(0) 推荐(0) 编辑

Unique Paths II <leetcode>

摘要: Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space i... 阅读全文

posted @ 2014-09-16 10:14 菱纱梦 阅读(214) 评论(0) 推荐(0) 编辑

2014年9月15日 #

C++学习笔记 <hash_map> <散列映射>

摘要: 对于大型容器而言hash_map要比map快5至10倍的元素查找速度。map对其元素类型要求有一个 m1; //用 m2; //用Nocase()比较串hash_map hm1; //用Hash()散列,用==比较hash_map hm2; //用hfct()散列,用==比... 阅读全文

posted @ 2014-09-15 18:13 菱纱梦 阅读(323) 评论(0) 推荐(0) 编辑

Longest Consecutive Sequence <leetcode>

摘要: 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 @ 2014-09-15 10:42 菱纱梦 阅读(371) 评论(0) 推荐(0) 编辑