6300 Signed Binary Representation of IntegersComputing ax mod n for large integers x and n is the most time-consuming process in most public-keycrypto...
分类:
其他好文 时间:
2015-03-21 01:04:35
阅读次数:
268
Same Tree Total Accepted: 52651 Total Submissions: 125166 My Submissions Question Solution
Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered e...
分类:
其他好文 时间:
2015-03-20 23:50:46
阅读次数:
166
1、完全二叉树(Complete Binary Tree)的概念若设二叉树的深度为h,除第 h 层外,其它各层 (1~h-1) 的结点数都达到最大个数,第 h 层所有的结点都连续集中在最左边,这就是完全二叉树。完全二叉树是由满二叉树而引出来的。对于深度为K的,有n个结点的二叉树,当且仅当其每一个结点...
分类:
其他好文 时间:
2015-03-20 21:51:51
阅读次数:
122
Reverse Bits Total Accepted: 8148 Total Submissions: 29905 My Submissions Question Solution
Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary a...
分类:
其他好文 时间:
2015-03-20 20:31:03
阅读次数:
105
具体思路和中序遍历是一致的,只是访问结点的值的时机不同罢了,具体思路参见:http://blog.csdn.net/mnmlist/article/details/44312315...
分类:
其他好文 时间:
2015-03-20 16:33:15
阅读次数:
121
思路:
具体的思路和层序遍历一致,只是需要将偶数层的结点值颠倒一下即可,时间略长,可见本方法并非好的方法。思路详见层序遍历:http://blog.csdn.net/mnmlist/article/details/44490975...
分类:
其他好文 时间:
2015-03-20 16:28:25
阅读次数:
131
一般的层序遍历直接打印出结果,用队列即可,但是此次的要求尼是按层次打印结果,所以考虑到用两个队列来交替存储,遍历上一层次的同时将下一层的结点存储到另一个队列中,并在将上面一层的遍历完成后交换两个队列的值。...
分类:
其他好文 时间:
2015-03-20 14:28:08
阅读次数:
140
一般的层序遍历直接打印出结果,用队列即可,但是此次的要求尼是按层次打印结果,所以考虑到用两个队列来交替存储,遍历上一层次的同时将下一层的结点存储到另一个队列中,并在将上面一层的遍历完成后交换两个队列的值。最后,将结果列表调换下顺序即可。...
分类:
其他好文 时间:
2015-03-20 14:25:18
阅读次数:
131
Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100";思路: 对齐, 计算当前位和进位;如果位较长,让我想到了先行进位加法器,不过这里的计算不...
分类:
其他好文 时间:
2015-03-20 12:35:07
阅读次数:
129
本文是在学习中的总结,欢迎转载但请注明出处:http://blog.csdn.net/pistolove/article/details/44486547
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...
分类:
其他好文 时间:
2015-03-20 09:21:19
阅读次数:
141