31.如何权衡是使用无序的数组还是有序的数组? 有序数组最大的好处在于查找的时间复杂度是O(log n),而无序数组是O(n)。有序数组的缺点是插入操作的时间复杂度是O(n),因为值大的元素需要往后移动来给新元素腾位置。相反,无序数组的插入时间复杂度是常量O(1)。 34.HashSet和TreeS ...
分类:
编程语言 时间:
2017-02-27 18:59:41
阅读次数:
189
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1->2->3 whic ...
分类:
其他好文 时间:
2017-02-27 01:16:22
阅读次数:
163
链接:https://www.nowcoder.com/practice/e08819cfdeb34985a8de9c4e6562e724?tpId=46&tqId=29030&tPage=1&rp=1&ru=/ta/leetcode&qru=/ta/leetcode/question-rankin ...
分类:
其他好文 时间:
2017-02-26 12:08:35
阅读次数:
207
https://leetcode.com/problems/serialize-and-deserialize-binary-tree/?tab=Description 下面这个解法里面的C++部分很好: https://discuss.leetcode.com/topic/28041/recurs ...
分类:
其他好文 时间:
2017-02-26 01:16:03
阅读次数:
181
Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical a ...
分类:
其他好文 时间:
2017-02-25 18:41:24
阅读次数:
153
Given a binary tree, return the preorder traversal of its nodes' values. Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [1,2,3]. Note: Recursive soluti ...
分类:
其他好文 时间:
2017-02-25 15:58:38
阅读次数:
169
1 /** 2 * Definition for a binary tree node. 3 * public class TreeNode { 4 * int val; 5 * TreeNode left; 6 * TreeNode right; 7 * TreeNode(int x) { val... ...
分类:
其他好文 时间:
2017-02-24 13:36:06
阅读次数:
188
Given a binary search tree (BST) with duplicates, find all the mode(s) (the most frequently occurred element) in the given BST. Assume a BST is define ...
分类:
其他好文 时间:
2017-02-23 23:56:14
阅读次数:
352
二叉树的遍历 无外乎广度和深度 其中深度又分为前中后序遍历三种情况 这三种遍历若只是递归方法 自然很是简单 但递归代码简单 若嵌套层次太深 会栈溢出 二叉树节点数据结构: struct Binary_node{ int val; Binary_node *left; Binary_node *rig ...
分类:
其他好文 时间:
2017-02-23 17:20:25
阅读次数:
150
1、查看是否开启了binlog:show binary logs; 默认情况下是不开启的。 2、开启binlog:修改mysql的配置文件my.ini。添加如下配置: 该文件默认不允许修改,需要右键“管理员取得所有权”之后才能保存修改。 另外,需要注意的是图中的my.ini位于:C:\Program ...
分类:
数据库 时间:
2017-02-23 16:04:50
阅读次数:
318