
郝斌数据结构
asty008
喜欢编程,网络和硬件
展开
-
郝斌数据结构 25 判断链表是否为空和求链表长度算法的演示
#include #include #include #include typedef struct Node { int data; //数据域 struct Node *pNext; //指针域 }NODE,*PNODE; //NODE等价于struct Node PNODE等价于struct Node * PNODE cre翻译 2016-12-21 10:22:24 · 498 阅读 · 0 评论 -
郝斌数据结构 13 连续存储数组的算法演示_2
#include #include #include #include struct Arr //定义了一个数据类型,该数据类型名字叫struct Arr { int *pBase;//存储的是数组第一个元素的地址 int len; //数组所能容纳的最大元素的个数 int cnt; //当前数组有效元素的个数 }; void init_arr(struct翻译 2016-12-20 16:53:19 · 501 阅读 · 0 评论 -
郝斌数据结构 57 汉诺塔
#include void hannuota(int n, char A, char B, char C) { // 如果是1个盘子 // 直接将A柱子上的盘子从A移到C // 否则 // 先将A柱子上的n-1个盘子借助C移到B // 直接将A柱子上的盘子从A移到C // 最后将B柱子上n-1个盘子借助A移到C翻译 2016-12-30 22:38:36 · 301 阅读 · 0 评论 -
郝斌数据结构 12 连续存储数组的算法演示
#include #include #include #include struct Arr //定义了一个数据类型,该数据类型名字叫struct Arr { int *pBase;//存储的是数组第一个元素的地址 int len; //数组所能容纳的最大元素的个数 int cnt; //当前数组有效元素的个数 }; void init_arr(struct翻译 2016-12-20 09:36:52 · 590 阅读 · 0 评论 -
郝斌数据结构 47 循环队列程序演示
#include #include #include #define LEN 6 typedef struct Queue { int *pBase; int front; int rear; }QUEUE; void init(QUEUE *pQ); bool en_queue(QUEUE *pQ,int val); void traverse_queue(QUEU翻译 2016-12-29 12:02:35 · 556 阅读 · 0 评论 -
郝斌数据结构 39~44 循环队列需要几个参数来确定及其含义的讲解
循环队列的讲解: 1.静态队列为什么必须是循环队列 2.循环队列需要几个参数来确定 需要2个参数来确定 front rear 2个参数不同场合有不同的含义 建议初学者先记住,然后慢慢体会 1) 队列初始化 front和rear的值都是零 2) 队列非空 front代表的是队列的第一个元素 rear代表的是队列的最后一个有效元素的下一个元素 3) 队列空 front和re翻译 2016-12-25 10:39:01 · 409 阅读 · 0 评论 -
郝斌数据结构 10 跨函数使用内存讲解及其示例
#include #include struct Student { int sid; int age; }; struct Student * CreateStudent(void) { struct Student *p = (struct Student *)malloc(sizeof(struct Student)); p->sid = 10;翻译 2016-12-18 22:56:02 · 375 阅读 · 0 评论 -
郝斌数据结构 09 malloc动态分配内存概述
#include #include int main(void) { // int a[5] = {5,6,7,8,9}; int len; int i; printf("请输入你需要分配的数组长度:len = " ); scanf("%d", &len); int *pArr = (int *)malloc(sizeof(int)*len);翻译 2016-12-18 21:20:19 · 472 阅读 · 0 评论 -
郝斌数据结构 06 所有指针变量只占4个字节(相对于32位来说) 用第一个字节的地址表示整个变量的地址
#include int main(void) { double *p; double x = 66.6; p = &x; //x占8个字节 1个字节一个地址,1个字节是8位 double arr[3] = {1.1, 2.2, 3.3}; double *q; q = &arr[0]; printf("%p\n",q); //%p实翻译 2016-12-18 11:13:28 · 640 阅读 · 2 评论 -
郝斌数据结构 05 预备知识_指针
===翻译 2016-12-18 10:56:33 · 364 阅读 · 0 评论 -
郝斌数据结构 33 栈程序演示
#include #include #include #include typedef struct Node { int data; struct Node * pNext; }NODE,* PNODE; typedef struct Stack { PNODE pTop; PNODE pBottom; }STACK,* PSTACK; void initS翻译 2016-12-23 22:51:25 · 607 阅读 · 0 评论 -
郝斌数据结构 28 链表的插入和删除算法的演示
#include #include #include #include typedef struct Node { int data; //数据域 struct Node *pNext; //指针域 }NODE,*PNODE; //NODE等价于struct Node PNODE等价于struct Node * PNODE cre翻译 2016-12-21 15:47:46 · 560 阅读 · 0 评论 -
郝斌数据结构 26 通过链表排序算法的演示 再次详细讨论到底什么是算法和泛型
#include #include #include #include typedef struct Node { int data; //数据域 struct Node *pNext; //指针域 }NODE,*PNODE; //NODE等价于struct Node PNODE等价于struct Node * PNODE cre翻译 2016-12-21 11:54:47 · 408 阅读 · 0 评论 -
郝斌数据结构 24 链表创建和链表遍历算法的演示
#include #include #include typedef struct Node { int data; //数据域 struct Node *pNext; //指针域 }NODE,*PNODE; //NODE等价于struct Node PNODE等价于struct Node * PNODE creat_list(v翻译 2016-12-20 22:28:23 · 475 阅读 · 1 评论