ecently I had an interesting surprise with concurrent inserts into a MyISAM table. The inserts were not happening concurrently with SELECT statements;...
分类:
其他好文 时间:
2015-01-05 01:46:52
阅读次数:
156
Populating Next Right Pointers in Each NodeGiven a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLi...
分类:
其他好文 时间:
2015-01-04 20:56:53
阅读次数:
156
Follow up for problem "Populating Next Right Pointers in Each Node".
What if the given tree could be any binary tree? Would your previous solution still work?
Note:
You may only use constant ...
分类:
其他好文 时间:
2015-01-04 13:37:37
阅读次数:
139
Given a binary tree
struct TreeLinkNode {
TreeLinkNode *left;
TreeLinkNode *right;
TreeLinkNode *next;
}
Populate each next pointer to point to its next right node....
分类:
其他好文 时间:
2015-01-04 13:37:21
阅读次数:
94
Given a binary tree, flatten it to a linked list in-place.
For example,
Given
1
/ 2 5
/ \ 3 4 6
The flattened tree should look like:
1
...
分类:
其他好文 时间:
2015-01-04 12:12:13
阅读次数:
128
https://oj.leetcode.com/problems/add-binary/http://blog.csdn.net/linhuanmars/article/details/20192227publicclassSolution{
publicStringaddBinary(Stringa,Stringb){
StringBuildersb=newStringBuilder();
char[]charsA=a.toCharArray();
char[]charsB=b.toCharArray(..
分类:
其他好文 时间:
2015-01-04 11:35:00
阅读次数:
156
讨论分为3种,第一种是搜索队列中任意我们需求的结果,第三种我们需求队列中有多个返回第一个,第四种未我们搜索队列中有多个返回最后一个元素的index。
第一种: 在一行排好序队列a中搜索target,一定有。
int binarySearch(int a[],int n, int target)
{
int start = 0,end = n-1;
while(start...
分类:
编程语言 时间:
2015-01-04 11:31:06
阅读次数:
152
1、是二叉搜索树(Binary Search Tree)2、树和所有左右子树高度之差为-1,0,1平衡因子(balance factor) =右子树高度-左子树高度平衡化旋转: 1、从插入位置向根节点计算节点的平衡因子; 2、若发现不平衡点(即平衡因子绝对值大于1),从此节点向下取两层; 3...
分类:
其他好文 时间:
2015-01-04 01:07:09
阅读次数:
421
Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.
Calling next() will return the next smallest number in the BST.
Note: next()...
分类:
其他好文 时间:
2015-01-03 22:26:17
阅读次数:
219
题目:
解决方案:
/**
* Definition for binary tree
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/
public class Solu...
分类:
其他好文 时间:
2015-01-03 19:53:41
阅读次数:
181