题目:
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 and the nodes have the same value.
Ans...
分类:
编程语言 时间:
2015-01-12 16:44:08
阅读次数:
216
题目:
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.
For example:
Given the below binary tree a...
分类:
编程语言 时间:
2015-01-12 16:40:36
阅读次数:
221
1. 红黑树(RED-BLACK TREE)引言:红黑树(RBT)可以说是binary-search tree的非严格的平衡版本。与之相应的是平衡二叉树(Balanced Binary Tree)又称之为AVL树(因为是G.M. Adelson-Velsky 和 E.M. Landis在1962年发...
分类:
编程语言 时间:
2015-01-12 15:56:55
阅读次数:
357
Given a sorted array of integers, find the starting and ending position of a given target value.
Your algorithm's runtime complexity must be in the order of O(log
n).
If the target is not found in...
分类:
其他好文 时间:
2015-01-12 09:29:25
阅读次数:
119
一. 二叉堆的性质 堆是一种具有堆序性的完全二叉树. 作为一种完全二叉树, (假定空树的高度是-1)它的高度是floor(logN), 高度为h的结点有2^h到2^(h+1) - 1个, 父节点的下标为floor(i/2), 左孩子的下标为2i, 右孩子的下标为2i+1 而所谓堆序性就是(以最小堆为...
分类:
其他好文 时间:
2015-01-12 09:14:35
阅读次数:
133
一、数据类型1、二进制类型:(有长度限制,可放800个0、1)格式:binary[(n)] --固定长度的n个字节二进制数据varbinary[(n)] --n个字节变长的二进制数据2、字符数据格式:char[(n)] --固定长度为n的字...
分类:
数据库 时间:
2015-01-12 09:12:59
阅读次数:
185
The problem:Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The...
分类:
其他好文 时间:
2015-01-12 06:44:16
阅读次数:
176
The problem:Given a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then right to left for the next ...
分类:
其他好文 时间:
2015-01-12 01:34:47
阅读次数:
189
erlang提供了binary_to_term,把一个二进制数据转为原始的erlang数据。但是,这个函数也有副作用。如果直接将对端传来的数据做一次 binary_to_term,就可能会导致VM crash掉。...
分类:
其他好文 时间:
2015-01-12 00:25:58
阅读次数:
309
2.Representing and Manipulating Information本章从二进制、字长、字节序,一直讲到布尔代数、位运算,最后无符号、有符号整数、浮点数的表示和运算。诚然有些地方的数学证明有些枯燥,但总体上看,本章还是干货十足的!2.1 Decimal vs. Binary Notation我们习惯十进制只是因为我们有十根手指头(?),所以会对二进制感到不习惯。但是二值信号(tw...
分类:
移动开发 时间:
2015-01-11 23:05:42
阅读次数:
561