erlang提供了两个函数用于erlang数据与二进制的转换,term_to_binary 把erlang数据转成一个二进制数据,binary_to_term 则是把二进制数据转为原始的erlang数据。这两个函数都是c实现的,效率很高,可用于序列化和反序列化数据,可以被直接用来当作网络封包协议。文章主要探讨这种二进制协议数据的组织形式,以及用erlang语言实现binary_to_term...
分类:
编程语言 时间:
2015-01-09 01:35:30
阅读次数:
282
The problem:Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node con...
分类:
其他好文 时间:
2015-01-09 00:07:50
阅读次数:
208
QUESTIONImplement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Calling next() will retur...
分类:
其他好文 时间:
2015-01-08 23:57:45
阅读次数:
282
问题描述:
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.
基本思想:
与Largest Rectangle in Histogram
思想类似,只是对每行都执行了一遍。
代码:
int ma...
分类:
其他好文 时间:
2015-01-08 22:47:03
阅读次数:
166
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le...
分类:
其他好文 时间:
2015-01-08 20:06:49
阅读次数:
131
MySQL提供的字符串类型包括CHAR、VARCHAR、BLOB、TEXT、ENUM和SET。对这些类型作一个简要的叙述如下:CHAR(M) [BINARY]一个定长字符串,当存储时,总是是用空格填满右边到指定的长度。在MySQL3.23以前的版本,M的范围是1 ~ 255个字符,在MySQL3.2...
分类:
其他好文 时间:
2015-01-08 16:55:50
阅读次数:
111
Given a binary tree, return thepostordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[3,2,1].No...
分类:
其他好文 时间:
2015-01-08 15:14:07
阅读次数:
208
有关于查找基本的库函数有find(),find_if,binary_search(),lower_bound(),upper_bound(),equal_range()另外bind1st(greater,15),bind2nd(greater,15),greater(15,x),count_if()...
分类:
其他好文 时间:
2015-01-08 14:43:06
阅读次数:
156
Design an algorithm and write code to serialize and deserialize a binary tree. Writing the tree to a file is called 'serialization' and reading back f...
分类:
其他好文 时间:
2015-01-08 13:17:33
阅读次数:
207
The problem:Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.My...
分类:
其他好文 时间:
2015-01-08 13:15:07
阅读次数:
109