摘要: 点击查看代码 //Delete a node from bst #include<iostream> struct node { int data; node* left; node* right; }; node* getnewnode(int x) { node* temp = new node 阅读全文
posted @ 2024-02-15 15:58 bituion 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 点击查看代码 //Check if a given binary tree is BST #include<iostream> #define MIN -999999 #define MAX 999999 struct node { int data; node* left; node* right 阅读全文
posted @ 2024-02-14 12:44 bituion 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 点击查看代码 //Binary tree traversal-- beadth-first and depth-first #include<iostream> #include<queue>//STL using namespace std; struct node { int data; nod 阅读全文
posted @ 2024-01-23 21:57 bituion 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 点击查看代码 //Binary tree traversal-- level-order traversal using queue #include<iostream> #include<queue>//STL using namespace std; struct node { int data 阅读全文
posted @ 2024-01-23 20:36 bituion 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 点击查看代码 #include<iostream> using namespace std; struct Node { int data; Node *left, *right; }; Node* newNode(int x) { Node* temp = new Node; temp->data 阅读全文
posted @ 2024-01-23 19:16 bituion 阅读(8) 评论(0) 推荐(0) 编辑
摘要: 点击查看代码 #include<iostream> using namespace std; struct Node { int data; Node *left, *right; }; Node* newNode(int x) { Node* temp = new Node; temp->data 阅读全文
posted @ 2024-01-23 18:41 bituion 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 点击查看代码 #include<iostream> using namespace std; struct Node { int data; Node *left, *right; }; Node* newNode(int x) { Node* temp = new Node; temp->data 阅读全文
posted @ 2024-01-23 17:39 bituion 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 点击查看代码 #include<iostream> using namespace std; struct Node { int data; Node *left, *right;//注意声明格式 }; Node* newNode(int x) { Node* temp = new Node; te 阅读全文
posted @ 2024-01-23 16:35 bituion 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 点击查看代码 #include <iostream> using namespace std; struct Node { int data; Node* left; Node* right; }; Node* newNode(int x) { Node* temp = new Node; temp 阅读全文
posted @ 2024-01-23 16:06 bituion 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 尾递归(Tail Recursion)是一种特殊形式的递归,其特点是递归调用是函数的最后一个操作。在尾递归中,递归调用的返回值不需要进行额外的操作,而是直接返回给调用者。这种特殊的结构使得编译器有机会对递归调用进行优化,称为尾递归优化。 尾递归函数的特征是,在递归调用中,没有后续的计算步骤,直接将递 阅读全文
posted @ 2024-01-23 12:02 bituion 阅读(8) 评论(0) 推荐(0) 编辑
点击右上角即可分享
微信分享提示