数据结构
小跑007
记录学习过程
展开
-
从数据结构角度对链表进行操作
#include<stdio.h>#include<malloc.h>#include<stdlib.h>typedef struct Node{ int data; struct Node * pNext;}NODE,*PNODE;PNODE create_list(void);void traverse_list(PNODE pHead);bool is_e...原创 2018-04-30 21:50:54 · 460 阅读 · 0 评论 -
数据结构角度进行出栈、入栈操作
#include<stdio.h>#include<malloc.h>#include<stdlib.h>typedef struct Node{ int data; struct Node * pNext;}NODE,* PNODE;typedef struct Stack{ PNODE pTop; PNODE pBottom;}STACK,* PSTACK;...原创 2018-05-01 20:05:14 · 402 阅读 · 0 评论 -
数据结构角度对队列进行操作
#include<stdio.h>#include<malloc.h>typedef struct Queue{ int * pBase; int front; int rear;}QUEUE;void init(QUEUE *pQ);bool en_queue(QUEUE *,int val);void traverse_queue(QUEUE *);bool full_...原创 2018-05-05 00:40:46 · 153 阅读 · 0 评论 -
递归思想下几个小程序
一:递归阶乘a.递归思想#include<stdio.h>long f(long n){ if(1==n) return 1; else return f(n-1)*n;}int main(void){ printf("%d\n",f(6)); return 0;}b.循环思想# include <stdio.h>int main(void){ int val; int...原创 2018-05-05 12:11:04 · 156 阅读 · 0 评论 -
二叉树遍历输出
#include<stdio.h>#include<malloc.h>struct BTNode{ char data; struct BTNode * pLchild; struct BTNode * pRchild;};struct BTNode * CreateBTree(void);void PreTraverseBTree(struct BTNode * pT);...原创 2018-05-05 21:41:16 · 478 阅读 · 0 评论 -
快速排序
#include<stdio.h>int FindPos(int * a,int low,int high);void QuickSort(int * a,int low ,int high);int main(void){ int a[6] = {-2, 1, 0, -985, 4, -93}; int i; QuickSort(a,0,5); for(i=0;i<6;++i)...原创 2018-05-05 22:42:07 · 136 阅读 · 0 评论 -
从数据结构的角度对数组进行算法操作(第一个比较长的程序)
#include <stdio.h>#include<malloc.h>#include<stdlib.h>struct Arr{ int * pBase; //存储的是数组第一个元素的地址,, pBase指向一个数组。 int len; //数组所能容纳的最大元素的个数 int cnt; // 理解cnt的含义当前数组有效元素的个数};void in...原创 2018-04-27 19:54:19 · 106 阅读 · 0 评论