所谓拳不离手曲不离口,算法和基础不能丢。
话说三藏师徒四人辞别女儿国,再上西行路,今天来到。。。啊呸,扯远了。。
今天来看这个,https://oj.leetcode.com/proble…,题目是这么说的
Given a linked list, determine if it has a cycle in it.
Follow up:
Can you solve it without using extra space?
这题…… 阅读全文
Linked List Cycle
1
所谓拳不离手曲不离口,算法和基础不能丢。
话说三藏师徒四人辞别女儿国,再上西行路,今天来到。。。啊呸,扯远了。。
今天来看这个,https://oj.leetcode.com/proble…,题目是这么说的
Given a linked list, determine if it has a cycle in it.
Follow up:
Can you solve it without using extra space?
这题…… 阅读全文
今晚在这里看到一篇文章,http://coolshell.cn/articles/8…,原文给的是代码片段,本着动手实践的原则,另外顺便复习一下链表,写了下代码
#include <stdio.h>
#include <stdlib.h>
typedef struct _node {
int n;
struct _node *next;
} node;
typedef int (* remove_fn)(node const …… 阅读全文
今天上午自己写了一个链表的反转
#include <stdio.h>
#include <stdlib.h>
typedef struct _node
{
int n;
_node *next;
} node;
int create_link(node **phead)
{
int x = 0;
printf("input nums, press Ctrl+Z(win) or Ctrl+D(linux) to endn");
if (scanf("%d", &x) <…… 阅读全文