计算机底层负数实现

2017-01-11
阅读 4 分钟
2.6k
Java采用”2的补码“(Two's Complement)编码负数,它是一种数值的编码方法,要分二步完成:第一步,每一个二进制位都取相反值,0变成1,1变成0。比如,+8的二进制编码是00001000,取反后就是11110111。第二步,将上一步得到的值加1。11110111就变成11111000。所以,00001000的2的补码就是11111000。也就是说,-8在计算机(...

LeetCode 6_ZigZag Conversion

2017-01-11
阅读 2 分钟
1.2k
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)

LeetCode 4_Median of Two Sorted Arrays

2017-01-10
阅读 4 分钟
1.5k
There are two sorted arrays a and a of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).

算法(第4版) Chapter 1

2017-01-04
阅读 2 分钟
2.1k
Algorithms Fourth EditionWritten By Robert Sedgewick & Kevin WayneTranslated By 谢路云