数据结构程序运行时手机一直闪屏怎么办怎么办

数据结构:求大神帮忙编一下这个程序,运行出来要图3那样的,谢谢!_百度知道
数据结构:求大神帮忙编一下这个程序,运行出来要图3那样的,谢谢!
提问者采纳
亲我我原写二叉树程序给直接数值改变觉我给没间帮调
你先发给我看一下好吧
#define Max 10struct nodes{int lc,}A[Max]={{'0',0,0},{'A',2,3},{'B',4,5},{'C',0,6},{'D',0,0},{'E',0,7},{'F',8,9},{'G',0,0},{'H',0,0},{'I',0,0}};void preorder(int root){ printf(&%c&,A[root].data);if (A[root].lc!=0)preorder(A[root].lc);if (A[root].rc!=0)preorder(A[root].rc);}}void main(){int root=1;printf(&preorder\n&);preorder(root);}
这是前序遍历的实现
1、已知二叉树用下面的顺序结构存储 #define Max=20struct nodes{
//存结点值int lc,
//存左右孩子下标,0表示无左、右孩子}A[Max];2、写出前序、中序和后序遍历该二叉树的算法。实验程序: 前序遍历#define Max 10struct nodes{int lc,}A[Max]={{'0',0,0},{'A',2,3},{'B',4,5},{'C',0,6},{'D',0,0},{'E',0,7},{'F',8,9},{'G',0,0},{'H',0,0},{'I',0,0}};void preorder(int root){ printf(&%c&,A[root].data);if (A[root].lc!=0)preorder(A[root].lc);if (A[root].rc!=0)preorder(A[root].rc);}}void main(){int root=1;printf(&preorder\n&);preorder(root);}
中序遍历#define Max 10struct nodes{int lc,}A[Max]={{'0',0,0},{'A',2,3},{'B',4,5},{'C',0,6},{'D',0,0},{'E',0,7},{'F',8,9},{'G',0,0},{'H',0,0},{'I',0,0}};void inorder(int root){if (A[root].lc!=0)inorder(A[root].lc);printf(&%c&,A[root].data);if (A[root].rc!=0)inorder(A[root].rc);}void main(){int root=1;printf(&inorder\n&);inorder(root);} 后序遍历#define Max 10struct nodes{int lc,}A[Max]={{'0',0,0},{'A',2,3},{'B',4,5},{'C',0,6},{'D',0,0},{'E',0,7},{'F',8,9},{'G',0,0},{'H',0,0},{'I',0,0}};void postorder(int root){ if (A[root].lc!=0)postorder(A[root].lc);if (A[root].rc!=0)postorder(A[root].rc); printf(&%c&,A[root].data);}void main(){int root=1;printf(&postorder\n&);postorder(root);}
三种遍历都给你了!
这要三部分弄在一起吗?
我有一份我之前验证三种的综合实验,可以给你参考结合起来!
就是你需要到什么遍历你用调用他的子程序!
#include &stdio.h&#include &stdlib.h&int GetValue(int oper,int oper1,int oper2) ;typedef char TElemT
//定义元素类型为字符型typedef struct BTNode
//定义二叉树的二叉链表结构{TElemT
//存放结点的数据,字符类型struct BTNode *lchild, *
//存放左、右子树的指针}BTNBTNode * CreateBTree(char *nodelist,int i){
BTNode * //声明新结点指针
if(nodelist[i]==0||i&7)//递归的终止条件
return NULL;
//为新结点分配内存空间
newnode=(BTNode *)malloc(sizeof(BTNode));
//将字符存入新结点
newnode-&data=nodelist[i];
//递归建立左子树
newnode-&lchild=CreateBTree(nodelist,2*i);
//递归建立右子树
newnode-&rchild=CreateBTree(nodelist,2*i+1);
//返回复制树的位置
}}void PreTraverse(BTNode *bt){
if(bt!=NULL)
//遍历的终止条件
printf(&%c&,bt-&data);
//打印结点内容
PreTraverse(bt-&lchild);
//递归遍历左子树
PreTraverse(bt-&rchild);
//递归遍历右子树
InTraverse(BTNode * bt){
if(bt!=NULL)
//遍历的终止条件
InTraverse(bt-&lchild);
//递归遍历左子树
printf(&%c&,bt-&data);
//打印结点内容
InTraverse(bt-&rchild);
//递归遍历右子树
PostTraverse(BTNode * bt){
if(bt!=NULL)
//遍历的终止条件
PostTraverse(bt-&lchild);
//递归遍历左子树
PostTraverse(bt-&rchild);
//递归遍历右子树
printf(&%c&,bt-&data);
//打印结点内容
}}int Calculate(BTNode * bt){
int oper1=0;
//前操作数
int oper2=0;
//后操作数
if(bt-&lchild==NULL && bt-&rchild==NULL)
return bt-&data-48;
oper1=Calculate(bt-&lchild);
//左子树
oper2=Calculate(bt-&rchild);
//右子树
return (GetValue(bt-&data,oper1,oper2));
}}int GetValue(int oper,int oper1,int oper2){
int result=0;
switch((char)oper)
case '*': result=oper1*oper2;return(result);
case '/':result=oper1/oper2;return(result);
case '+':result=oper1+oper2;return(result);
case '-':result=oper1-oper2;return(result);
}}void main(){BTNode * root=NULL;
//声明表达式二叉树指针
//声明结算结果变量
//声明二叉树数组结点数据//char nodelist[8]={'-','+','*','/','4','8','6','2'};root=CreateBTree(nodelist,1);
//建立表达式二叉树
//输出前缀表达式
printf(&\n 前缀表达式PreTraverse expression:[&);
PreTraverse(root);
printf(&]\n&);
//输出中缀表达式
printf(&\n InTraverse expression:[&);
InTraverse(root);
printf(&]\n&);
//输出后缀表达式
printf(&\n PostTraverse expression:[&);
PostTraverse(root);
printf(&]\n&);
//计算表达式结果
result=Calculate(root);
printf(&\n calculate result is [%2d]\n&,result);
getchar();}
跟着这份该就可以了。亲,我只能帮到这里了。
可以采纳吗?
等我晚上自习回来试试之后再采纳
好吧,你需要对你的要求进行修改,因为这是我当时的程序,题目和你不一样,但是要求是一样的!
亲,能采纳了吗?
提问者评价
太给力了,你的回答完美的解决了我的问题!
其他类似问题
为您推荐:
数据结构的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁我的电脑启动到桌面之后,鼠标就一直闪不停,就像有程序在启动一样,怎么办?_百度知道
我的电脑启动到桌面之后,鼠标就一直闪不停,就像有程序在启动一样,怎么办?
鼠标等待符号直闪停使用求高手帮助谢谢
我有更好的答案
卸载遨游软件重装试试,看来不是鼠标的问题,像是软件的问题。
如果故障依旧,建议先查杀一下木马,修复一下系统试试。
建议你下载恶意软件和木马强杀工具windows清理助手查杀恶意软件和木马:
下载网址:
下载安装后,首先升级到最新版本,然后退出正常模式并重启按F8进入到安全模式。打开软件,点击“系统扫描”,对扫描结果全选,然后点击“执行清理”按钮,如果软件提示你是否“备份”,选择“是”(备份是为了防止发生清理错误,如果清理后系统没有发生异常,就删除备份),按提示进行操作即可(软件也可以在正常模式中进行查杀)。
1、开机按F8不动到高级选项出现在松手,选“最近一次的正确配置”回车修复。
2、开机按F8进入安全模式后在退出,选重启或关机在开机,就可以进...
如果你QQ,迅雷什么的这类软件选了开机运行,那么你开机时也会出现这种情况。总之是你开机时有程序在后台运行。
最好是用杀毒软件扫描下病毒,用360安全卫士找下插件和关一些启动项,这样会好一些
应该是开机启动程序太多造成!可以到运行MSCONFIG 删除多余的程序!
注销一下电脑
垃圾文件太多,一键清理
其他类似问题
为您推荐:
电脑启动的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁数据结构问题:运行程序是崩溃。_百度知道
数据结构问题:运行程序是崩溃。
#include &stdio.h&#include &stdlib.h&#define Stack_Size 50#define FALSE 0;#define TURE 1;typedef struct{ int elem[Stack_Size];}SeqSvoid InitStack(SeqStack *S){ S-&top=1;}void ClearStack(SeqStack *S){ int i=0; for (i=0;i&=Stack_Si++); {
if(S-&elem[i]!=NULL)
S-&elem[i]=NULL; } } int
Push(SeqStack *S,int x){ if (S-&top==Stack_Size-1) {
return FALSE; } else
S-&elem[S-&top]=x;
return TURE; }}int GetTop(SeqStack *S){
if(S-&top==1) {
return FALSE;
x=S-&elem[S-&top]; }}int main(void){ int x,z; printf(&hahah&); int GetTop(SeqStack *S); void InitStack(SeqStack *S); int Push(SeqStack *S,int m); SeqStack *A; InitStack(A); z=Push(A,10); x=GetTop(A); printf(&%d&,&x); return 0;}
提问者采纳
建议系统化习软件发能提高自能力五月花校软件发培训
提问者评价
其他类似问题
为您推荐:
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁8个LED灯的闪烁效果 - c语言程序开发技术文章 - 红黑联盟
8个LED灯的闪烁效果
//----------8个LED灯闪烁------------//
//----------------------------------//
//-----------杭哥工作室------------//
//-----------设计者:吕杭剑--------//
//-----------QQ:----------//
//---------------------------------//
#include&reg51.h&
void delay(unsigned int d_time);
void main(void)
delay(20000);
delay(20000);
void delay(unsigned int d_time)
for(;d_time&0;d_time--);

我要回帖

更多关于 微信一直闪退怎么办 的文章

 

随机推荐