C简单算法的实现
来碗炸酱面
这个作者很懒,什么都没留下…
展开
-
结构体下嵌套结构体的小例子
#include struct A { int a; int b;};struct B { struct A a; /*调用结构体A,命名为a*/ int b;};static struct B a = {{5,3},2}; /*给名为a到结构原创 2013-11-07 10:19:18 · 1201 阅读 · 0 评论 -
linux下编译运行c 程序小总结
编译: gcc -g 1.c -o 1.o运行:gdb 1 l 1 (中间有空格,从第一行还是显示程序,按enter可以显示余下到) run(简写r 也可,运行程序,显示结果) quit (简写q,退出gdb)原创 2013-11-07 10:12:40 · 607 阅读 · 0 评论 -
判断字符串中是否有重复字符
实现一个算法来判断一个字符串中的字符是否唯一(即没有重复).不能使用额外的数据结构。 (即只使用基本的数据结构)学习自 http://hawstein.com/posts/1.1.html#include#includebool isunique1(char s[]){ bool a[256]; memset(a,0,sizeof(a)); //注意初始赋值 in原创 2013-11-20 21:09:18 · 2944 阅读 · 0 评论 -
c链表反转
#include #include typedef struct node{ int data; struct node *next;}List;List* init(int len){ List *h,*p,*r; h=(List*)malloc(sizeof(List));h->next=NULL; i原创 2013-11-01 16:51:36 · 639 阅读 · 0 评论 -
Reverse Linked List II
Reverse Linked List II Reverse a linked list from position m to n. Do it in-place and in one-pass.For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4, return 1->4->3->2->5-原创 2014-03-13 16:15:28 · 593 阅读 · 0 评论