https://github.com/basemax/cbinarytreesequality
This is a C implementation of the Binary-Trees Equality program to check two binary trees are identical or not.
https://github.com/basemax/cbinarytreesequality
bin-tree binary-tree binary-tree-c binary-trees bintree c data-structure datastructure ds tree
Last synced: about 2 months ago
JSON representation
This is a C implementation of the Binary-Trees Equality program to check two binary trees are identical or not.
- Host: GitHub
- URL: https://github.com/basemax/cbinarytreesequality
- Owner: BaseMax
- License: gpl-3.0
- Created: 2023-02-03T12:15:31.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-03T12:24:46.000Z (over 3 years ago)
- Last Synced: 2025-10-23T13:45:56.424Z (8 months ago)
- Topics: bin-tree, binary-tree, binary-tree-c, binary-trees, bintree, c, data-structure, datastructure, ds, tree
- Language: C
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# C Binary-Trees Equality
This is a C implementation of the Binary-Trees Equality program to check two binary trees are identical or not.
A binary tree is a tree data structure in which each node has at most two children, which are referred to as the left child and the right child.
## How to run
```bash
$ gcc BinaryTreesEquality.c -o BinaryTreesEquality
$ ./BinaryTreesEquality
```
## Example
```c
// 1st tree
struct node *root1 = newNode(1);
root1->left = newNode(2);
root1->right = newNode(3);
root1->left->left = newNode(4);
root1->left->right = newNode(5);
// 2nd tree
struct node *root2 = newNode(1);
root2->left = newNode(2);
root2->right = newNode(3);
root2->left->left = newNode(4);
root2->left->right = newNode(5);
if (areIdentical(root1, root2))
printf("Both trees are identical");
else
printf("Trees are not identical");
```
Copyright (c) 2023, Max Base