题目:连接两个链表。 程序分析:无。 实例: 1 #include <stdlib.h> 2 #include <stdio.h> 3 struct list 4 { 5 int data; 6 struct list *next; 7 }; 8 typedef struct list node; ...
分类:
其他好文 时间:
2020-07-14 13:05:22
阅读次数:
57
题目:反向输出一个链表。 程序分析:无。 实例: 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<malloc.h> 4 typedef struct LNode{ 5 int data; 6 struct LNode *next; 7 }LN ...
分类:
其他好文 时间:
2020-07-14 13:05:03
阅读次数:
56
typedef long long ll; typedef unsigned long long ull; #define maxn 1005 struct My_Hash { ull base=131; ull p[maxn],ha[maxn]; void Insert(char s[]) { i ...
分类:
其他好文 时间:
2020-07-14 00:58:42
阅读次数:
62
两个代码举例 回调函数: 定义一个普通函数作为处理函数 将处理函数地址注册给调用者 调用者在适当的时候通过函数指针调用处理函数 //c-style typedef void (*fooFunc1)(char*); //定义函数指针 void handle1(char* str){ /* func b ...
分类:
编程语言 时间:
2020-07-13 12:04:18
阅读次数:
62
剑指OFFER_构建乘积数组 题目描述 给定一个数组A[0,1,...,n-1],请构建一个数组B[0,1,...,n-1],其中B中的元素B[i]=A[0]A[1]...*A[i-1]A[i+1]...*A[n-1]。不能使用除法。(注意:规定B[0] = A[1] * A[2] * ... * ...
分类:
编程语言 时间:
2020-07-13 11:46:36
阅读次数:
53
#include<stdio.h> #define MaxSize 255 typedef struct { char ch[MaxSize]; int length; }SString; void InitStr(SString &S) { S.ch[0]='¥'; S.length=0; } v ...
分类:
其他好文 时间:
2020-07-12 22:19:57
阅读次数:
122
一、什么是循环双链表 从上一节我们看出循环单链表是尾节点指针指向头节点,那么以此类推,我们的循环双链表就是头节点的prior指针指向尾节点。所以我们在判断循环双链表是否为空时就是其prior和next同时指向一个节点就为空。 循环双链表的结构: typedef struct CDLinkNode { ...
分类:
其他好文 时间:
2020-07-12 18:39:29
阅读次数:
64
一、什么是循环单链表 循环单链表与单链表最本质的区别就是最后一个指针指向的节点不是NULL而是指向头节点,从而形成一个闭环。 所以我们在判断指针是否指向尾节点时候的判断条件就是他的next是否指向头节点。 循环单链表的结构: typedef struct { //定义循环单链表的节点类型 ElemT ...
分类:
其他好文 时间:
2020-07-12 18:33:37
阅读次数:
59
图的邻接矩阵存储 源程序 #include <stdio.h>#include <stdlib.h> const int vnum=20; //定义图的类型typedef struct gp{ char verx[vnum]; int arcs[vnum][vnum]; int vernum,arc ...
分类:
其他好文 时间:
2020-07-12 17:06:40
阅读次数:
48
图的带权邻接矩阵存储 源程序: #include <stdio.h>#include <stdlib.h>#define VNUM 20const int MAX_INT=0; //图的类型定义typedef struct gp{ char vexs[VNUM]; int arcs[VNUM][VN ...
分类:
其他好文 时间:
2020-07-12 16:30:10
阅读次数:
54