/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(...
分类:
其他好文 时间:
2015-03-16 22:56:26
阅读次数:
116
* Copyright (C) 2008 mymtom (mymtom@hotmail.com)* All rights reserved.** Redistribution and use in source and binary forms, with or without* modificat...
分类:
编程语言 时间:
2015-03-16 22:50:42
阅读次数:
201
2.思路
a.先遍历左子树直至左孩子为空
b.然后看当前节点的右子树是否为空,为空,则访问当前节点,弹出当前节点,重新判断;不为空,访问当前节点,然后将当前节点弹出,并将当前节点的右孩子进栈,返回a
c.这中间需要注意的是,在弹出当前节点后,在获得栈顶的当前节点前先判断下栈是否为空...
分类:
其他好文 时间:
2015-03-16 21:19:34
阅读次数:
118
使用非常简单, frame 就是当前帧, foreground 是取得的, binary 型背景, 0.03是学习速率可以根据实际调整.
cv::BackgroundSubtractorMOG mog;
mog(frame, foreground, 0.03);...
分类:
移动开发 时间:
2015-03-16 17:55:01
阅读次数:
170
题目地址:https://leetcode.com/problems/search-in-rotated-sorted-array/Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are give...
分类:
其他好文 时间:
2015-03-16 17:48:11
阅读次数:
97
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).
For example:
Given binary tr...
分类:
其他好文 时间:
2015-03-16 16:34:14
阅读次数:
107
题目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
2
...
分类:
其他好文 时间:
2015-03-16 16:33:35
阅读次数:
121
Reverse bits of a given 32 bits unsigned integer.
For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 001110010...
分类:
编程语言 时间:
2015-03-16 14:40:54
阅读次数:
156
Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).
For example, the 32-bit integer ’11' has binary representation 00000000...
分类:
编程语言 时间:
2015-03-16 12:57:41
阅读次数:
180
1.二叉排序树的定义 二叉排序树(Binary Sorting Tree)的定义如下: 二叉树或者是一棵空树,或者是一棵具有以下性质的二叉树: (1)若它有左子树,则左子树上所有结点的数据均小于根结点的数据。 (2)若它有右子树,则右子树上所有结点的数据均大于根结点的数据。 (3)左、右子...
分类:
编程语言 时间:
2015-03-16 12:33:54
阅读次数:
171