- 博客(15)
- 收藏
- 关注
原创 c++ 知识备忘
这里是作者遇到的一些C++ 编程的知识简介,可能每个条目都不全,只选取最常用的用法。1. C++ 模板模板格式template class 形参,class形参 ……> //class可以用 typename代替返回类型名 函数名(参数列表){函数体}举例:类模板template class 形参, class 形参 ……>
2017-11-30 16:28:05 163
原创 c++ 编程易错易混点总结
不断更新……这是本人编程中经常搞错的东西,在此记录下来,便于查询复习……1. :: -> . 三者的应用场景::是作用域操作符,表示你引用的变量限定在该作用域内。::的左值为一个类,右值为该类的对象或方法。class C{ void fun(); }在类外实例化fun()和访问fun的时候就要用到C::fun();
2017-10-24 11:17:04 273
原创 leetcode: 669. Trim a Binary Search Tree
题目解析:题目链接:https://leetcode.com/problems/trim-a-binary-search-tree/description/Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that all its eleme
2017-10-02 16:02:01 178
原创 树遍历方式总结:层次遍历、先序遍历、中序遍历、后序遍历
做leetcode的过程中总是遇到树的这些操作,特此总结一下,便于以后查看。其中层次遍历属于广度优先搜索,其他属于深度优先搜索。我之前数据结构零基础,因此,在过程中算法可能不够完美,请各位留言指正。另外,会借鉴别的算法,用来比较学习,如果有侵权,请联系博主~这里用类似leetcode的命名规则。树结构声明:struct treeNode{ int val; treeNod
2017-10-01 19:51:43 1150
原创 vs2013编程错误总结
在实验室做项目用到windows + vs2013的平台,c++还是个小白,有时候师兄的程序也会跑出问题,在摸索中解决问题的过程也挺有趣,特此做个记录,便于以后查找。因为工程多,错误想来也会多,先按照错误类型排列吧。1. Error LINK2001 无法解析的外部符号:有一个前人的总结,有需要的可以移步观看:http://blog.csdn.net/shenyulv/ar
2017-10-01 10:09:49 340
原创 leetcode; 104. Maximum Depth of Binary Tree
题目解析:题目链接:https://leetcode.com/problems/maximum-depth-of-binary-tree/description/Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path
2017-09-30 10:51:37 186
原创 leetcode: 226. Invert Binary Tree
题目解析:题目链接:https://leetcode.com/problems/invert-binary-tree/description/Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3
2017-09-29 11:41:31 155
原创 leetcode: 258. Add Digits
题目解析:题目链接:https://leetcode.com/problems/add-digits/description/Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.给定一个非负整数num,重复相加所有位数的值直
2017-09-29 09:50:18 135
原创 leetcode: 448. Find All Numbers Disappeared in an Array
题目解析:题目链接:https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/description/Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and o
2017-09-28 16:15:09 138
原创 leetcode: 371. Sum of Two Integers
题目解析:题目链接:https://leetcode.com/problems/sum-of-two-integers/description/Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.不用+和-符号计算两个整数的和。E
2017-09-28 15:11:43 151
原创 leetcode: 653. Two Sum IV - Input is a BST
题目解析:题目链接:https://leetcode.com/problems/two-sum-iv-input-is-a-bst/description/Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their
2017-09-28 10:22:34 276
原创 leetcode: 283. Move Zeroes
题目描述:题目链接:https://leetcode.com/problems/move-zeroes/description/Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero el
2017-09-27 16:20:57 120
原创 leetcode: 606. Construct String from Binary Tree
题目解析:题目链接:https://leetcode.com/problems/construct-string-from-binary-tree/description/You need to construct a string consists of parenthesis and integers from a binary tree with the preorder t
2017-09-27 10:56:42 162
原创 leetcode: 538. Convert BST to Greater Tree
538题:题目:Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum of all keys greater than the original key i
2017-09-26 19:41:31 149
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人