![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
初级数据结构
蚂蚁帅帅
这个作者很懒,什么都没留下…
展开
-
C语言实现栈的创建、压栈、出栈、返回栈顶元素
栈结构体typedef struct node//定义栈结点类型{ int data; struct node * next;}Node;typedef struct myStack//定义栈结构{ int size; Node * top;}myStack;创建栈void createStack(myStack ** s)//创建栈{ if(*s != NULL)//预防译编程 { printf("指针不为空"); return; } *s = (mySt原创 2020-08-27 21:33:12 · 1709 阅读 · 0 评论 -
C语言 实现队列的创建,入队、出队、返回队首元素等操作
队列 (先进先出)//队列(新建,出队,入队等操作)typedef struct node{ int data; struct node *next;}Node;typedef struct myQueue{ int size; Node *front; Node *rear;}my_Queue;#include <stdio.h>#include <malloc.h>#include <string.h>my_Queue *crea.原创 2020-08-27 21:18:56 · 2970 阅读 · 0 评论 -
C语言实现 合并两个有序链表,实现每n个节点进行逆序
合并两个有序链表typedef struct Node{ int data; struct Node *next;}Linklist;#include <stdio.h>#include <malloc.h>void create_list(Linklist ** phead,int n) { int i=0; int count=0; Linklist *pnew=NULL; Linklist *temp=NULL; *phead=(Linkl.原创 2020-08-27 21:12:34 · 286 阅读 · 0 评论 -
C语言实现单链表的创建、增、删、改、查、逆序、冒泡排序
链表相关操作://创建一个链表,并进行增删改查定义结构体:typedef struct Node{ int data; struct Node *next;}Linklist;1.主函数相关调用语句int main(){ int num=0; Linklist * phead=NULL; puts("请输入需要创建的节点数"); scanf("%d",&num); create_list(&phead,num); //通过指针的指针进行头指针的改变 tra原创 2020-08-27 21:09:03 · 270 阅读 · 1 评论