The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integernrepresenting the total number...
分类:
其他好文 时间:
2014-10-27 20:59:08
阅读次数:
164
【题意简述】:就是定义了另外一种数制的表示形式,并给了你这种数制表示形式与十进制的转换关系,现在给你一个这样的数制,让你把它换成2进制输出。
【分析】:其中 base[k] = 2^(k+1)-1 = 2(2^k-1)+1 = 2base[k-1]+1
// 200K 0Ms
#include
#include
using namespace std;
int main()
{
...
分类:
其他好文 时间:
2014-10-27 19:33:42
阅读次数:
163
递归实现(python):# Definition for a binary tree nodeclass TreeNode: def __init__(self, x): self.val = x self.left = None self...
分类:
其他好文 时间:
2014-10-27 17:21:37
阅读次数:
125
http://www.aspnettutorials.com/tutorials/database/store-img-bins-asp4-cs/http://stackoverflow.com/questions/18998763/how-to-retrieve-binary-image-from...
分类:
数据库 时间:
2014-10-27 14:15:27
阅读次数:
145
Question:Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100"Solution: 1 #define MAX_STR_LEN (100...
分类:
其他好文 时间:
2014-10-27 12:31:45
阅读次数:
187
Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf path1->2->3which rep...
分类:
编程语言 时间:
2014-10-27 08:10:18
阅读次数:
196
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 an...
分类:
其他好文 时间:
2014-10-27 08:09:30
阅读次数:
167
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.Solution:/** * Definition for binary tree * public cl...
分类:
其他好文 时间:
2014-10-27 06:51:31
阅读次数:
137
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5083题目意思:如果给出 instruction 就需要输出对应的16-bit binary code,给出16-bit binary code 就需要输出对应的instruction。 由于不会截取的....
分类:
其他好文 时间:
2014-10-27 00:15:41
阅读次数:
354
简单地用递归的方法实现了二分查找算法,适用于数组。二分查找算法的前提条件是数组本身是有序的,比如int arr[6] = {2, 3, 5, 7, 11, 13}; 1 int 2 BinarySearch(int arr[], int key, int left, int right) 3 { 4...
分类:
其他好文 时间:
2014-10-26 22:47:44
阅读次数:
232