#include <stdio.h>
#define MaxSize 10
typedef struct Queue{
int data[MaxSize];
int head,tail;
}Queue;
void InitQueue(Queue &S){
S.head=0;
S.tail=0;
}
......................
阅读全部 | 2025年3月19日 23:28
#include <stdio.h>
#define MaxSize 50
//创建栈以及栈的基本操作
typedef struct Stack{
int data[MaxSize];
int top;
}Stack;
void InitStack(Stack &S){
S.top=0;
}
......................
阅读全部 | 2025年3月19日 23:20
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
typedef struct Lnode{
struct Lnode* next;
char data;
}Lnode,*ListLink;
//第一种方法
/*bool match(ListLink L,int n){
char A[n/2];Lnode *p=L;
for(int i=0;i<=(n-1)/2;i++){p=p->next;A[i]=p->data;}
......................
阅读全部 | 2025年3月19日 00:10
#include<stdlib.h>
#include<stdio.h>
#define maxsize 100
typedef struct{
int data[maxsize];
int length;
}List;
int SearchList(List &L,int e){
int min =0;int max=L.length-1;int mean=(max+min)/2;
if(L.data[min]==e){return min+1;}
if(L.data[max]==e){return max+1;}
......................
阅读全部 | 2025年3月12日 22:55
#include<stdio.h>
#include<stdlib.h>
#define Maxsize 10
typedef struct{
int data;
int next;
}node,ListLink[Maxsize];
int main(){
node A[Maxsize];
printf("sizeof(%zu)\n",sizeof(A));
node a;
......................
阅读全部 | 2025年3月12日 21:08
#include<stdio.h>
#include<stdlib.h>
typedef struct Lnode{
int data;
Lnode *next;
}Lnode, *ListLink;
//创建链表
bool InitList(ListLink L){
L=(ListLink)malloc(sizeof(Lnode));
L->next=NULL;
return true;
......................
阅读全部 | 2025年3月12日 20:30