- 博客(6)
- 资源 (1)
- 收藏
- 关注
转载 leetcode:clone graph
1 /** 2 * Definition for undirected graph. 3 * struct UndirectedGraphNode { 4 * int label; 5 * vector neighbors; 6 * UndirectedGraphNode(int x) : label(x) {}; 7 * }; 8 */ 9
2016-05-31 16:22:16 260
原创 序列式容器:vecor,stack,queue用法
1.序列式容器c++本身提供了一种序列式容器array,STL提供了vector,list,deque,stack,queue,priority-queue。2.vector概述与array相似,array是静态空间,一旦配置了就不能改变,而vector是动态空间,随着元素的加入,它的内部机制会自动扩充空间以容纳新元素,它是一个连续线性空间。支持的操作:size():元素个数
2016-05-27 11:40:59 542
转载 leetcode:binary-tree-preorder-traversal
题目描述:Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,2,3].实现:1.递归方式cl
2016-05-23 22:19:13 179
转载 leetcode:binary-tree-postorder-traversal
题目描述:树的后序遍历Given a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[3,2,1].实现:1.递
2016-05-22 22:36:10 245
转载 leetcode:Minimum Depth of Binary Tree
题目描述:Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.(从根节点到叶节点经过的最短路径经过的节点数)实现:1
2016-05-20 21:28:52 200
转载 单链表回文结构判断
题目描述:对于一个链表,请设计一个时间复杂度为O(n),额外空间复杂度为O(1)的算法,判断其是否为回文结构。给定一个链表的头指针A,请返回一个bool值,代表其是否为回文结构。保证链表长度小于等于900。测试样例:1->2->2->1返回:true题目解析:思路1:空间O(n) 整个链表遍历两边, 开一个栈,第一遍遍历把链表中每个元素push进
2016-05-12 15:12:07 1961
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人