llllmz

导航

2024年1月24日

KY124 二叉搜索树C++

摘要: 先把BST建立起,然后递归遍历判断树就好了。 #include<iostream> #include<string> using namespace std; struct node{ char data; struct node* left; struct node* right; }; type 阅读全文

posted @ 2024-01-24 21:19 神奇的萝卜丝 阅读(32) 评论(0) 推荐(0)

KY207 二叉排序树C++

摘要: 考二叉搜索树的插入。 #include<iostream> using namespace std; struct node{ int data; struct node* left; struct node* right; }; typedef struct node tree; int main 阅读全文

posted @ 2024-01-24 20:54 神奇的萝卜丝 阅读(15) 评论(0) 推荐(0)

KY11 二叉树遍历C++

摘要: 这个题目思路其实就是先序遍历的变形。 相当于沿着先序遍历的顺序跟着构建二叉树就行。然后中序遍历这个树。 #include<iostream> #include<string> using namespace std; struct tnode{ char data; struct tnode* le 阅读全文

posted @ 2024-01-24 20:29 神奇的萝卜丝 阅读(20) 评论(0) 推荐(0)

KY212 二叉树遍历C++

摘要: 思路是先构造出树,然后在后序遍历整个树。 #include<iostream> #include<string> using namespace std; struct Tnode{ char data; struct Tnode* left; struct Tnode* right; }; typ 阅读全文

posted @ 2024-01-24 19:51 神奇的萝卜丝 阅读(24) 评论(0) 推荐(0)