Skip to content

A collection of C programs for learning and implementing binary tree operations, including traversal, insertion, deletion, and validation. Ideal for understanding fundamental data structures and algorithms in C programming.

License

Notifications You must be signed in to change notification settings

hima890/binary_trees

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Alt text

0x1D C - Binary Trees :

This project explores the concepts and implementation of binary trees in C, developed collaboratively with Ruba Salih. It covers various operations and properties of binary trees, enhancing understanding of data structures and algorithms.

Key Concepts Explored:

  • Understanding binary trees and their structure.
  • Differentiating between binary trees and Binary Search Trees (BST).
  • Comparing time complexity gains compared to linked lists.
  • Exploring tree properties such as depth, height, and size.
  • Implementing different traversal methods for binary trees.
  • Recognizing different types of binary trees: complete, full, perfect, and balanced.

Tasks Completed ✔️

  1. Function that creates a binary tree node.
  2. Function that inserts a node as the left-child of another node.
  3. Function that inserts a node as the right-child of another node.
  4. Function that deletes an entire binary tree.
  5. Function that checks if a node is a leaf.
  6. Function that checks if a given node is a root.
  7. Function that traverses a binary tree using pre-order traversal.
  8. Function that traverses a binary tree using in-order traversal.
  9. Function that traverses a binary tree using post-order traversal.
  10. Function that measures the height of a binary tree.
  11. Function that measures the depth of a node in a binary tree.
  12. Function that measures the size of a binary tree.
  13. Function that counts the leaves in a binary tree.
  14. Function that counts the nodes with at least 1 child in a binary tree.
  15. Function that measures the balance factor of a binary tree.
  16. Function that checks if a binary tree is full.
  17. Function that checks if a binary tree is perfect.
  18. Function that finds the sibling of a node.
  19. Function that finds the uncle of a node.
  20. Function that finds the lowest common ancestor of two nodes.
  21. Function that traverses a binary tree using level-order traversal.
  22. Function that checks if a binary tree is complete.
  23. Function that performs a left-rotation on a binary tree.
  24. Function that performs a right-rotation on a binary tree.
  25. Function that checks if a binary tree is a valid Binary Search Tree (BST).
  26. Function that inserts a value in a Binary Search Tree (BST).
  27. Function that builds a Binary Search Tree (BST) from an array.
  28. Function that searches for a value in a Binary Search Tree (BST).
  29. Function that removes a node from a Binary Search Tree (BST).
  30. Average time complexities of operations on a Binary Search Tree (BST).
  31. Function that checks if a binary tree is a valid AVL Tree (In progress).
  32. Function that inserts a value in an AVL Tree (In progress).
  33. Function that builds an AVL Tree from an array (In progress).
  34. Function that removes a node from an AVL Tree (In progress).
  35. Function that builds an AVL Tree from a sorted array (In progress).
  36. Average time complexities of operations on an AVL Tree (In progress).
  37. Function that checks if a binary tree is a valid Max Binary Heap (In progress).
  38. Function that inserts a value in a Max Binary Heap (In progress).
  39. Function that builds a Max Binary Heap from an array (In progress).
  40. Function that extracts the root node of a Max Binary Heap (In progress).
  41. Function that converts a Binary Max Heap to a sorted array (In progress).
  42. Average time complexities of operations on a Binary Heap (In progress).

Results 📈

Implemented Files:

Additional Information 🚧

Project Structre

. ├── 0-binary_tree_node.c ├── 100-binary_trees_ancestor.c ├── 101-binary_tree_levelorder.c ├── 101-main.c ├── 102-binary_tree_is_complete.c ├── 103-binary_tree_rotate_left.c ├── 104-binary_tree_rotate_right.c ├── 10-binary_tree_depth.c ├── 110-binary_tree_is_bst.c ├── 111-bst_insert.c ├── 112-array_to_bst.c ├── 113-bst_search.c ├── 114-bst_remove.c ├── 115-O ├── 11-binary_tree_size.c ├── 120-binary_tree_is_avl.c ├── 120-is_avl ├── 120-main.c ├── 121-avl_insert.c ├── 122-array_to_avl.c ├── 123-avl_remove.c ├── 124-sorted_array_to_avl.c ├── 12-binary_tree_leaves.c ├── 130-binary_tree_is_heap.c ├── 13-binary_tree_nodes.c ├── 14-binary_tree_balance.c ├── 15-binary_tree_is_full.c ├── 16-binary_tree_is_perfect.c ├── 17-binary_tree_sibling.c ├── 18-binary_tree_uncle.c ├── 1-binary_tree_insert_left.c ├── 2-binary_tree_insert_right.c ├── 3-binary_tree_delete.c ├── 4-binary_tree_is_leaf.c ├── 5-binary_tree_is_root.c ├── 6-binary_tree_preorder.c ├── 7-binary_tree_inorder.c ├── 8-binary_tree_postorder.c ├── 9-binary_tree_height.c ├── AUTHORS ├── binary_tree_print.c ├── binary_trees.h ├── LICENSE ├── Notes │ ├── c.txt │ └── github.txt ├── output │ └── binary_trees └── README.md

Note:

Functions files cant run without the main test case file

About

A collection of C programs for learning and implementing binary tree operations, including traversal, insertion, deletion, and validation. Ideal for understanding fundamental data structures and algorithms in C programming.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages