First Upload

This commit is contained in:
2022-02-25 15:33:16 +02:00
commit 0c74d10f0d
295 changed files with 74784 additions and 0 deletions

44
25 - Trees/ex1.c Normal file
View File

@@ -0,0 +1,44 @@
#include "General.h"
void InsertToBinaryTree(BinaryTree ** root, int k)
{
if (root == NULL)
{
MakeBinaryTree(root);
(*root)->info.int_ = k;
}
else if ((*root)->info.int_ > k)
{
if ((*root)->left == NULL)
{
AddLeftAfterBinaryTree(*root);
(*root)->left->info.int_ = k;
}
else
{
InsertToBinaryTree(&((*root)->left), k);
}
}
else if ((*root)->info.int_ < k)
{
if ((*root)->right == NULL)
{
AddRightAfterBinaryTree(*root);
(*root)->right->info.int_ = k;
}
else
{
InsertToBinaryTree(&((*root)->right), k);
}
}
else
{
printf("Duplicate!\n");
}
}
void main(void)
{
BinaryTree * bt;
}