This commit is contained in:
2025-09-15 21:12:04 +08:00
commit 3f58f483ff
144 changed files with 5298 additions and 0 deletions

28
else/topic/2020.h Normal file
View File

@@ -0,0 +1,28 @@
#include "../structs/Tree.h"
using namespace std;
TreeNode *getX(TreeNode *root, int x)
{
TreeNode *temp = root;
while (temp)
{
if (temp->val > x)
{
if (temp->left)
{
temp = temp->left;
continue;
}
}
else
{
if (temp->right)
{
temp = temp->right;
continue;
}
}
return temp;
}
}