摘要:
5429数据结构实验:树是否相同 int isSameTree(struct TreeNode* p, struct TreeNode* q)//相同返回1,否则返回0 { if(p==NULL && q==NULL)return 1; if(p==NULL || q==NULL)return 0; 阅读全文
posted @ 2023-02-20 15:09
CRt0729
阅读(112)
评论(0)
推荐(0)
摘要:
5420数据结构实验--二叉树中序遍历(二叉链表存储) void inorder(Bitnode *t) //中序 { if(t->left)inorder(t->left); cout<<" "<<t->val; if(t->right)inorder(t->right); } 5421数据结构实 阅读全文
posted @ 2023-02-20 15:00
CRt0729
阅读(66)
评论(0)
推荐(0)
摘要:
基于链表存储按输入顺序构造的二叉树,输入为-1时结束 #include <stdio.h> #include <stdlib.h> struct TreeNode { int val; struct TreeNode *left,*right; }; struct TreeNode a[520]; 阅读全文
posted @ 2023-02-20 13:40
CRt0729
阅读(37)
评论(0)
推荐(0)

浙公网安备 33010602011771号