- 博客(12)
- 资源 (4)
- 收藏
- 关注
原创 LeetCode 142. Linked List Cycle II
Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Note: Do not modify the linked list.Follow up:Can you solve it without using extra space?一、
2016-03-18 13:00:14 414
原创 LeetCode 160. Intersection of Two Linked Lists
Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a1 → a2 ↘
2016-03-10 20:32:02 361
原创 LeetCode 328. Odd Even Linked List
Given 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 should try to do it in
2016-03-10 20:08:05 388
原创 字符串数组逆序
实现数组字符串的逆序,要求是O(n) O(1)时空复杂度;#include void reverse(char *str){ int i,j; char temp; i=0; j=strlen(str)-1; while(i<j){ temp=str[i]; str[i]=str[j]; str[j]=temp; i++; j--; }}int mai
2016-03-10 18:42:25 1509
原创 单链表排序之选择排序
对单链表进行选择排序,选择排序算是比较直观的排序算法,利用C语言实现#include struct ListNode{ int val; struct ListNode *next;};struct ListNode *create_list(){ int i; struct ListNode *head=(struct ListNode*)malloc(sizeof(struc
2016-03-10 15:05:28 1692
原创 C语言常见编程题及答案40题
【程序1】题目:判断101-200之间有多少个素数,并输出所有素数。1.程序分析:判断素数的方法:用一个数分别去除2到sqrt(这个数),如果能被整除, 则表明此数不是素数,反之是素数。 2.程序源代码:#include int IsPrime(int n){ int i=2; for(i=2;i<=sqrt(n);i++){ if(n%i==
2016-03-10 11:20:39 78585 15
原创 LeetCode 83. Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3.一、算法分析处理不带头结点的单链表,涉及到
2016-03-10 10:28:35 323
原创 LeetCode 19. Remove Nth Node From End of List
Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the
2016-03-10 01:18:38 361
原创 LeetCode 203. Remove Linked List Elements
Remove all elements from a linked list of integers that have value val.ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 --> 3 --> 4 --> 5一、算法分析本来很简单的一道题,但是Le
2016-03-10 01:06:16 316
原创 LeetCode 206. Reverse Linked List
Reverse a singly linked list.click to show more hints.Hint:A linked list can be reversed either iteratively or recursively. Could you implement both?一,算法分析头插法重建单链表,注意默认链表是没有头结点的,所以建表的时候不
2016-03-09 01:57:28 372
原创 LeetCode 21. Merge Two Sorted Lists
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.一,算法分析类似两个数组的合并,注意OJ给的链表默认是不带头结点的;另外两个数相等的时候可以归到大于或小于
2016-03-09 01:40:20 529
原创 LeetCode 234. 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?一,算法分析大体思想是利用快慢两个指针找到中间节点,然后将后面半个链表进行逆转;依次与前半部分比较,若相等则说明是回文串;二,C语言实现/*
2016-03-09 01:03:46 401
Linux内核完全剖析基于0.12内核.pdf (附linux kernel 0.12源码和测试软件,亲测可用)
2017-06-02
json所需的全部jar包(共7个-亲测可用)
2015-10-08
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人