0x1D.C - Binary Trees

This repository contains the implementation of binary trees as part of the Holberton School curriculum, specifically in the "0x1D.C" project. The purpose of this project is to understand and implement binary tree data structures and related algorithms in the C programming language.

Table of Contents

About Binary Trees

A binary tree is a type of hierarchical data structure in which each node has at most two children, referred to as the left child and the right child. Binary trees are widely used in computer science and form the basis for various tree-based algorithms and data structures.

Understanding binary trees is essential for developing efficient solutions to problems involving data organization, searching, sorting, and more.

Project Structure

This repository contains the following files and directories related to the "0x1D.C" project:

  • binary_trees.h: Header file containing the structure definitions and function prototypes for binary tree operations.
  • binary_tree_print.c: Source code file implementing the function to print binary trees.
  • 0-binary_tree_node.c: Source code file containing the implementation of a function to create a new binary tree node.
  • 1-binary_tree_insert_left.c: Source code file containing the implementation of a function to insert a node as the left child of a given node.
  • 2-binary_tree_insert_right.c: Source code file containing the implementation of a function to insert a node as the right child of a given node.
  • 3-binary_tree_delete.c: Source code file containing the implementation of a function to delete an entire binary tree.
  • 4-binary_tree_is_leaf.c: Source code file containing the implementation of a function to check if a given node is a leaf.
  • 5-binary_tree_is_root.c: Source code file containing the implementation of a function to check if a given node is the root of a binary tree.
  • 6-binary_tree_preorder.c: Source code file containing the implementation of a function to traverse a binary tree in preorder.
  • 7-binary_tree_inorder.c: Source code file containing the implementation of a function to traverse a binary tree in inorder.
  • 8-binary_tree_postorder.c: Source code file containing the implementation of a function to traverse a binary tree in postorder.
  • 9-binary_tree_height.c: Source code file containing the implementation of a function to calculate the height of a binary tree.
  • 10-binary_tree_depth.c: Source code file containing the implementation of a function to calculate the depth of a given node in a binary tree.
  • 11-binary_tree_size.c: Source code file containing the implementation of a function to calculate the size (number of nodes) of a binary tree.
  • 12-binary_tree_leaves.c: Source code file containing the implementation of a function to count the number of leaves in a binary tree.
  • 13-binary_tree_nodes.c: Source code file containing the implementation of a function to count the number of nodes with at least one child in a binary tree.
  • 14-binary_tree_balance.c: Source code file containing the implementation of a function to calculate the balance factor of a binary tree.
  • 15-binary_tree_is_full.c: Source code file containing the implementation of a function to check if a binary tree is full.
  • 16-binary_tree_is_perfect.c: Source code file containing the implementation of a function to check if a binary tree is perfect.
  • 17-binary_tree_sibling.c: Source code file containing the implementation of a function to find the sibling of a given node in a binary

tree.

  • 18-binary_tree_uncle.c: Source code file containing the implementation of a function to find the uncle of a given node in a binary tree.
  • README.md: This file, providing an overview of the project and instructions for getting started.

Getting Started

To explore the "0x1D.C - Binary Trees" project, follow these steps:

  1. Clone this repository to your local machine using the following command:

    git clone https://github.com/Abiodun001-world/0x1D.C-Binary_trees.git
  2. Read the source code files to understand the implementations of various binary tree functions.

  3. Modify the code or create additional files as needed for your own binary tree projects.

Contributing

Contributions to this repository are not accepted as it represents a specific project within the Holberton School curriculum. However, if you have suggestions or find any issues, please feel free to reach out or create a fork of this repository to work on your own binary tree implementations.

License

This project is licensed under the MIT License. Feel free to use and modify the code as needed.