c
BUPT-Yukino
这个作者很懒,什么都没留下…
展开
-
BUPT数据结构第二次大作业第二题
代码仅供参考,建议读者先自行思考如下:#include<stdio.h>#include<stdlib.h>typedef struct node { struct node* bottom; char data; int size;}stack;typedef struct q_node { char data; struct q_node* nextPtr;}list;typedef struct l_node { list* front; l原创 2021-10-16 16:34:01 · 211 阅读 · 0 评论 -
BUPT数据结构第二次大作业第一题进制转换(链式栈
代码仅供参考,希望读者先自行思考如下:#include<stdio.h>#include<stdlib.h>#include<math.h>typedef struct node { struct node* bottom; int size; char top_ele;}stack;stack* createstack(){ stack* a = (stack *)malloc(sizeof(stack)); a->bottom =原创 2021-10-16 14:12:14 · 129 阅读 · 0 评论 -
BUPT数据结构第二次大作业第一题进制转换(数组栈实现
建议读者先自行思考,代码仅供参考:#include<stdio.h>#include<math.h>typedef struct node { char data[1000]; int tptr;}stack;void push(stack* a, int tptr, char str){ a->data[tptr] = str;}void printstack(stack* a){ while (a->tptr >= 0) {原创 2021-10-16 11:34:03 · 115 阅读 · 0 评论 -
BUPT数据结构第一次大作业
§有n个加里森敢死队的队员要炸掉敌人的一个军火库,谁都不想去,队长加里森决定用轮回数数的办法来决定哪个战士去执行任务。规则如下:如果前一个战士没完成任务,则要再派一个战士上去。现给每个战士编一个号,大家围坐成一圈,随便从某一个编号为x的战士开始计数,当数到y时,对应的战士就去执行任务,且此战士不再参加下一轮计数。如果此战士没完成任务,再从下一个战士开始数数,被数到第y时,此战士接着去执行任务。以此类推,直到任务完成为止。加里森本人是不愿意去的,假设加里森为1号,请你设计一程序为加里森支招,求出n,x,y原创 2021-10-11 19:49:41 · 444 阅读 · 0 评论 -
单链表的逆转(c语言)
代码如下:#include<stdio.h>#include<stdlib.h>struct node { int num; struct node* nextptr;};void createlisthead(struct node** headptrptr){ *headptrptr = (struct node*)malloc(sizeof(struct node*)); if (*headptrptr != NULL) { (*headptrpt原创 2021-09-16 14:41:48 · 105 阅读 · 0 评论 -
C语言有序链表的元素添加
代码如下:#include<stdio.h>#include<stdlib.h>struct node { int num; struct node* nextptr;};void createlisthead(struct node** headptrptr){ *headptrptr = (struct node*)malloc(sizeof(struct node*)); if (*headptrptr != NULL) { (*headptrpt原创 2021-09-15 18:58:26 · 182 阅读 · 0 评论 -
C语言链表之空头链表的创立,及元素的插入
#include<stdio.h>#include<stdlib.h>struct node { int num; struct node* nextptr;};void createlisthead(struct node** headptr){ *headptr=(struct node*)malloc(sizeof(struct node)); if (*headptr != NULL) { (*headptr)->nextptr = NULL;.原创 2021-09-15 18:11:21 · 570 阅读 · 0 评论