We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 094c93b commit 5df8478Copy full SHA for 5df8478
Tree/search_tree.c
@@ -0,0 +1,40 @@
1
+#include <stdio.h>
2
+#include <stdlib.h>
3
+
4
+typedef struct node
5
+{
6
+ int value;
7
+ struct node* left;
8
+ struct node* right;
9
+} node;
10
11
+bool search_binary_tree(node*, const int);
12
13
+bool search_binary_tree(node* tree, const int value)
14
15
+ if (tree == NULL)
16
+ {
17
+ return false;
18
+ }
19
+ else if (value < tree->value)
20
21
+ return search(tree->left, value);
22
23
+ else if (value > tree->value)
24
25
+ return search(tree->right, value);
26
27
+ else if (value == tree->value)
28
29
+ return true;
30
31
+ else
32
33
34
35
+}
36
37
+int main(void)
38
39
+ return 0;
40
0 commit comments