⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stacktree.cpp

📁 这是一个关于数据结构重言式的判别
💻 CPP
字号:
#include"StackTree.h"
int InitStack(SqStack &s){
	s.base=(BiTree *)malloc(sizeof(struct BtNode));
	if(!s.base){
		printf("s.base malloc error in func InitStack\n");
		exit(1);
	}
	s.top=s.base;
	s.StackSize=Stack_Init_Size;
	return 1;
}
void Push(SqStack &s,BiTree e){//栈的推入操作
	*++s.top=e;
}
void Pop(SqStack &s,BiTree &e){//栈的弹出操作
	if(s.base==s.top) {
		printf("stack empty in func Pop\n");
		exit(1);
	}
	e=*s.top--;
}
void GetTop(SqStack s,BiTree &T){//获取栈顶的操作
	if(s.base==s.top) {
		printf("stack empty in func Pop\n");
		exit(1);
	}
	T=*s.top;
}
void Create(BiTree T,BiTree L,BiTree R){//建树的原子操作
	T->lchild=L;
	T->rchild=R;
	if(L->data>='A'&&L->data<='Z'){//叶结点则左右子树为空
		L->lchild=NULL;
		L->rchild=NULL;
	}
	if(R->data>='A'&&R->data<='Z'){
		R->lchild=NULL;
		R->rchild=NULL;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -