
C语言
Wenju-Huang
计算机视觉方向小硕一枚,热衷科研技术,关注计算机视觉,机器学习,机器人,信号处理,移动通信等领域。希望能结识更多同道中人
展开
-
C++异或运算符及作用
简略记忆:同0异11.由于0^0=0 0^1=1 所以,0^任何数 = 任何数2.由于1^0=1 1^1 =0所以,1^任何数 = 任何数取反3.任何数^任何数 = 0;4.用于将特定的位反转,如对10100001的第2位和第3位翻转,可以将数与00000110进行按位异或运算。原因见(2)5.通过按位异或运算,可以实现两个值的交换,而不必使用临时变量。转载 2015-07-25 20:32:10 · 2809 阅读 · 0 评论 -
LeetCode-Delete Node in a Linked List
LeetCode-Delete Node in a Linked List*Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Supposed the linked list is 1 -> 2 -> 3 -> 4 and you原创 2015-07-27 10:53:45 · 365 阅读 · 0 评论 -
LeetCode-Remove Nth Node From End of List
经过几个小时,渣渣终于把题解出来,虽然用的方法很土/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode*原创 2015-07-26 22:23:01 · 441 阅读 · 2 评论 -
LeetCode-Reverse Linked List
继续一道链表的算法题,运用笨笨的方法实现了(不过却是8ms,不可思议)/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class S原创 2015-07-29 21:39:33 · 334 阅读 · 0 评论 -
LeetCode-Palindrome Linked List
题目: Given a singly linked list, determine if it is a palindrome.Follow up: Could you do it in O(n) time and O(1) space?解释: 判断一个数是否为回文数(即这个数顺着看和倒着看相同,如1234321)。 一开始想的是用堆栈实现,但空间复杂度度不符合要求,一时想不到思路。虽然提示原创 2015-07-29 23:13:59 · 518 阅读 · 0 评论