{"id":22706490,"url":"https://github.com/wendymunyasi/binary_trees","last_synced_at":"2025-07-21T21:36:20.783Z","repository":{"id":72317179,"uuid":"528744852","full_name":"wendymunyasi/binary_trees","owner":"wendymunyasi","description":"Learn about binary tree and binary search tree.","archived":false,"fork":false,"pushed_at":"2022-12-21T12:39:07.000Z","size":112,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-06T21:11:38.794Z","etag":null,"topics":["algorithms","c","data-structures"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wendymunyasi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-25T07:38:33.000Z","updated_at":"2023-08-30T17:58:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"b31cc6d2-8587-451a-bb07-966d5af755e2","html_url":"https://github.com/wendymunyasi/binary_trees","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wendymunyasi/binary_trees","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wendymunyasi%2Fbinary_trees","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wendymunyasi%2Fbinary_trees/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wendymunyasi%2Fbinary_trees/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wendymunyasi%2Fbinary_trees/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wendymunyasi","download_url":"https://codeload.github.com/wendymunyasi/binary_trees/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wendymunyasi%2Fbinary_trees/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266384017,"owners_count":23920991,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-21T11:47:31.412Z","response_time":64,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithms","c","data-structures"],"created_at":"2024-12-10T10:08:50.523Z","updated_at":"2025-07-21T21:36:20.744Z","avatar_url":"https://github.com/wendymunyasi.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Project Name\n**0x1D. C - Binary trees**\n\n## Author's Details\nName: *Wendy Munyasi.*\n\nEmail: *wendymunyasi@gmail.com*\n\nTel: *+254707240068.*\n\n##  Requirements\n*   Allowed editors: `vi`, `vim`, `emacs`.\n*   All your files will be compiled on Ubuntu 20.04 LTS using gcc, using the options `-Wall -Werror -Wextra -pedantic -std=gnu89`.\n*   Your code should use the `Betty` style. It will be checked using `betty-style.pl` and `betty-doc.pl`.\n*   All your files should end with a new line.\n*   You are not allowed to use global variables.\n*   No more than 5 functions per file.\n*   You are allowed to use the standard library.\n*   The `main.c` files are used to test your functions, but you don’t have to push them to your repo.\n*   The prototypes of all your functions should be included in your header file called `binary_trees.h`.\n*   All your header files should be include guarded.\n\n\n##  More Info\n*   Please use the following data structures and types for binary trees for this project:\n\n**Basic Binary Tree**\n```\n/**\n * struct binary_tree_s - Binary tree node\n *\n * @n: Integer stored in the node\n * @parent: Pointer to the parent node\n * @left: Pointer to the left child node\n * @right: Pointer to the right child node\n */\nstruct binary_tree_s\n{\n    int n;\n    struct binary_tree_s *parent;\n    struct binary_tree_s *left;\n    struct binary_tree_s *right;\n};\n\ntypedef struct binary_tree_s binary_tree_t;\n```\n\n**Binary Search Tree**\n```\ntypedef struct binary_tree_s bst_t;\n```\n**AVL Tree**\n```\ntypedef struct binary_tree_s avl_t;\n```\n**Max Binary Heap**\n```\ntypedef struct binary_tree_s heap_t;\n```\n\n\n## Project Description\nLearn about what is a binary tree.\nWhat is the difference between a binary tree and a Binary Search Tree.\nWhat is the possible gain in terms of time complexity compared to linked lists.\nWhat are the depth, the height, the size of a binary tree.\nWhat are the different traversal methods to go through a binary tree.\nWhat is a complete, a full, a perfect, a balanced binary tree.\n\n\n* **0. New node** - Write a function that creates a binary tree node. - `0-binary_tree_node.c`.\n* **1. Insert left** - Write a function that inserts a node as the left-child of another node. - `1-binary_tree_insert_left.c`.\n* **2. Insert right** - Write a function that inserts a node as the right-child of another node. - `2-binary_tree_insert_right.c`.\n* **3. Delete** - Write a function that deletes an entire binary tree. - `3-binary_tree_delete.c`.\n* **4. Is leaf** - Write a function that checks if a node is a leaf. - `4-binary_tree_is_leaf.c`.\n* **5. Is root** - Write a function that checks if a given node is a root. - `5-binary_tree_is_root.c`.\n* **6. Pre-order traversal** - Write a function that goes through a binary tree using pre-order traversal. - `6-binary_tree_preorder.c`.\n* **7. In-order traversal** - Write a function that goes through a binary tree using in-order traversal. - `100-sorted_hash_table.c`.\n* **8. Post-order traversal** - Write a function that goes through a binary tree using post-order traversal. - `8-binary_tree_postorder.c`.\n* **9. Height** - Write a function that measures the height of a binary tree. - `9-binary_tree_height.c`.\n* **10. Depth** - Write a function that measures the depth of a node in a binary tree. - `10-binary_tree_depth.c`.\n* **11. Size** - Write a function that measures the size of a binary tree. - `11-binary_tree_size.c`.\n* **12. Leaves** - Write a function that counts the leaves in a binary tree. - `12-binary_tree_leaves.c`.\n* **13. Nodes** - Write a function that counts the nodes with at least 1 child in a binary tree. - `13-binary_tree_nodes.c`.\n* **14. Balance factor** - Write a function that measures the balance factor of a binary tree. - `14-binary_tree_balance.c`.\n* **15. Is full** - Write a function that checks if a binary tree is full. - `15-binary_tree_is_full.c`.\n* **16. Is perfect** - Write a function that checks if a binary tree is perfect. - `16-binary_tree_is_perfect.c`.\n* **17. Sibling** - Write a function that finds the sibling of a node. - `17-binary_tree_sibling.c`.\n* **18. Uncle** - Write a function that finds the uncle of a node. - `18-binary_tree_uncle.c`.\n* **19. Lowest common ancestor** - Write a function that finds the lowest common ancestor of two nodes. - `100-binary_trees_ancestor.c`.\n* **20. Level-order traversal** - Write a function that goes through a binary tree using level-order traversal. - `101-binary_tree_levelorder.c`.\n* **21. Is complete** - Write a function that checks if a binary tree is complete. - `102-binary_tree_is_complete.c`.\n* **22. Rotate left** - Write a function that performs a left-rotation on a binary tree. - `103-binary_tree_rotate_left.c`.\n* **23. Rotate right** - Write a function that performs a right-rotation on a binary tree. - `104-binary_tree_rotate_right.c`.\n* **24. Is BST** - Write a function that checks if a binary tree is a valid Binary Search Tree. - `110-binary_tree_is_bst.c`.\n* **25. BST - Insert** - Write a function that inserts a value in a Binary Search Tree. - `111-bst_insert.c`, `0-binary_tree_node.c`.\n* **26. BST - Array to BST** - Write a function that goes through a binary tree using in-order traversal. - ` 112-array_to_bst.c`, `111-bst_insert.c`, `0-binary_tree_node.c`.\n* **27. BST - Search** - Write a function that searches for a value in a Binary Search Tree. - `113-bst_search.c`.\n* **28. BST - Remove** - Write a function that removes a node from a Binary Search Tree. - `114-bst_remove.c`.\n* **29. Big O #BST** - What are the average time complexities of those operations on a Binary Search Tree (one answer per line). - `115-O`.\n* **30. Is AVL** - Write a function that checks if a binary tree is a valid AVL Tree. - `120-binary_tree_is_avl.c`.\n* **31. AVL - Insert** - Write a function that inserts a value in an AVL Tree. - `121-avl_insert.c`, `14-binary_tree_balance.c`, `103-binary_tree_rotate_left.c`, `104-binary_tree_rotate_right.c`, `0-binary_tree_node.c`.\n* **32. AVL - Array to AVL** - Write a function that builds an AVL tree from an array. - `122-array_to_avl.c`, `121-avl_insert.c`, `0-binary_tree_node.c`, `103-binary_tree_rotate_left.c`, `104-binary_tree_rotate_right.c`, `14-binary_tree_balance.c`.\n* **33. AVL - Remove** - Write a function that removes a node from an AVL tree. - `123-avl_remove.c`, `14-binary_tree_balance.c`, `103-binary_tree_rotate_left.c`, `104-binary_tree_rotate_right.c`.\n* **34. AVL - From sorted array** - Write a function that builds an AVL tree from an array. - `124-sorted_array_to_avl.c`, `0-binary_tree_node.c`.\n* **35. Big O #AVL Tree** - What are the average time complexities of those operations on an AVL Tree (one answer per line). - `125-O`.\n* **36. Is Binary heap** - Write a function that checks if a binary tree is a valid Max Binary Heap. - `130-binary_tree_is_heap.c`.\n* **37. Heap - Insert** - Write a function that inserts a value in Max Binary Heap. - `131-heap_insert.c`, `0-binary_tree_node.c`.\n* **38. Heap - Array to Binary Heap** - Write a function that builds a Max Binary Heap tree from an array. - `132-array_to_heap.c`, `131-heap_insert.c`, `0-binary_tree_node.c`.\n* **39. Heap - Extract** - Write a function that extracts the root node of a Max Binary Heap. - `133-heap_extract.c`.\n* **40. Heap - Sort** - Write a function that converts a Binary Max Heap to a sorted array of integers. - `134-heap_to_sorted_array.c`, `133-heap_extract.c`.\n* **41. Big O #Binary Heap** - What are the average time complexities of those operations on a Binary Heap (one answer per line). - `135-O`.\n\n\n## Collaborate\n\nTo collaborate, reach me through my email address wendymunyasi@gmail.com.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwendymunyasi%2Fbinary_trees","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwendymunyasi%2Fbinary_trees","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwendymunyasi%2Fbinary_trees/lists"}