![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
Heskey_包子
这个作者很懒,什么都没留下…
展开
-
【LeedCode】328. Odd Even Linked List
328. Odd Even Linked ListGiven a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.You sh原创 2016-01-23 13:05:30 · 366 阅读 · 0 评论 -
n & (n-1) 的妙用
今天无聊拿起《编程之美》看了下,发现原来n&(n-1)还有很多妙用。n&(n-1)作用:将n的二进制表示中的最低位为1的改为0先看一个简单的例子: n = 10100(二进制)则(n-1) = 10011===>n&(n-1) = 10000 可以看到原本最低位为1的那位变为0。弄明白了n&(n-1)的作用,那它有哪些应用?求某一个数的二进制表示中1的个数int NumberOf1 = 0;转载 2016-01-23 14:25:57 · 303 阅读 · 0 评论 -
理解选择排序
Select Sort 的理解Explain with a picPseudo-CodeWHILE UnsortedSize > 0 FIND the smallest value in the unsorted set AS the MIN // 在未排序的集合中,按顺序查找一个最小值 SWAP the MIN and the First element of the un原创 2016-01-25 20:21:03 · 228 阅读 · 0 评论