![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C语言
虚言假面
no pain, no gain.
展开
-
C语言实现顺序表的基本操作(创建,增,删,改,查)
C语言实现顺序表的基本操作写得比较烂#include <stdio.h>#include <stdlib.h>#define SIZE 2typedef struct Array{ int count; int isize; int *p;}List;List *initArray();//初始化并置空int creatList(List *list...原创 2019-04-30 19:41:14 · 3879 阅读 · 0 评论 -
C语言实现链表的基本操作(创建,增删改查,合并,冒泡排序)
#include <stdio.h>#include <stdlib.h>typedef struct Node{ int num; struct Node *next;}node;node *creat()//创建{ node *p1,*p2,*head; int n=0; p1=p2=malloc(sizeof(node)); head=NULL...转载 2019-04-30 19:54:33 · 1045 阅读 · 0 评论 -
C语言栈的基本操作(创建,入栈,出栈,清空,销毁,打印)
#include <stdio.h>#include <stdlib.h>#define STACKSIZE 100typedef struct{ int *top; int *base; int stacksize;}stack;typedef struct{ char *top; char *base; int nodesize;}Node;...原创 2019-04-30 19:59:53 · 7525 阅读 · 8 评论 -
C语言实现中缀表达式求值,计算器的简单实现
求表达式的值是栈的经典操作,我只简单地实现了正数的四则运算,包括括号运算,也可计算小数,没有检查表达式是否输入正确,以后再改进。实现过程中借鉴了其它博主的一些算法,如有侵权,我会立即删除。#include <stdio.h>#include <stdlib.h>typedef struct//操作数栈{ double *top; double *base; i...原创 2019-04-30 20:06:46 · 10116 阅读 · 6 评论 -
已知函数t(n)=2*t(n/2)+n,其中t(0)=0,n为整数,用递归和非递归(链栈)实现
非递归中用到了栈#include <stdio.h>#include <stdlib.h>typedef struct node{ int data; struct node *next;}Node;typedef struct{ Node *top; Node *base;}Stack;int InitNode(Stack *p){ p-&g...原创 2019-04-30 20:18:04 · 2676 阅读 · 1 评论 -
C语言队列的基本操作
#include <stdio.h>#include <stdlib.h>#define SIZE 100typedef struct node{ int *base; int front; int rear;}Node;int InitNode(Node *p){ p->base=(int *)malloc(SIZE*sizeof(int));...转载 2019-04-30 20:19:57 · 1475 阅读 · 0 评论 -
C语言循环队列实现约瑟夫游戏
#include <stdio.h>#include <stdlib.h>typedef struct node{ int *base; int front; int rear;}Node;/* 思路: *使用一个顺序循环队列来存放元素 *SIZE的值为元素个数+1,用一个空位来存放rear指针 *若未到数m,则将队头元素放在队尾,并使front后...原创 2019-04-30 20:21:47 · 1463 阅读 · 3 评论 -
C语言实现二叉树(创建,先序,中序,后序遍历的递归实现,以及非递归的中序遍历(栈),求树的高度)
#include <stdio.h>#include <stdlib.h>typedef struct node{ int data; struct node *lchild,*rchild;}Node;Node * CreatTree()//创建二叉树{ Node *p; int num; scanf("%d",&num); if(num=...转载 2019-04-30 20:25:20 · 3631 阅读 · 0 评论 -
数据结构Hash表(C语言版)的实现(创建,增删改查,求hash地址)
#include <stdio.h>#include <stdlib.h>#define SIZE 50#define Length 10int max=8;typedef struct Node{ int num; char name[20]; float score;}node;typedef struct List{ node *p; i...转载 2019-04-30 20:39:28 · 1935 阅读 · 0 评论