Skip to content

micahondiwa/binary_trees

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C-Binary trees

More pointers, arrays and strings

Technologies

  • Files written in vi, vim, and emacs editors.
  • C files compiled using gcc 9.4.0.
  • C files wriiten according to the betty coding style. Checked using betty-style.pl and betty-doc.pl.
  • Files tested on Ubuntu 20.04 LTS using gcc.

Files

File Question
0-binary_tree_node.c Write a function that creates a binary tree node.
1-binary_tree_insert_left.c Write a function that inserts a node as the left-child of another node.
2-binary_tree_insert_right.c Write a function that inserts a node as the right-child of another node.
3-binary_tree_delete.c Write a function that deletes an entire binary tree.
4-binary_tree_is_leaf.c Write a function that checks if a node is a leaf.
5-binary_tree_is_root.c Write a function that checks if a given node is a root.
6-binary_tree_preorder.c Write a function that goes through a binary tree using pre-order traversal.
7-binary_tree_inorder.c Write a function that goes through a binary tree using in-order traversal.
8-binary_tree_postorder.c Write a function that goes through a binary tree using post-order traversal.
9-binary_tree_height.c Write a function that measures the height of a binary tree.
10-binary_tree_depth.c Write a function that measures the depth of a node in a binary tree.
11-binary_tree_size.c Write a function that measures the size of a binary tree.
12-binary_tree_leaves.c Write a function that counts the leaves in a binary tree.
13-binary_tree_nodes.c Write a function that counts the nodes with at least 1 child in a binary tree.
14-binary_tree_balance.c Write a function that measures the balance factor of a binary tree.
15-binary_tree_is_full.c Write a function that checks if a binary tree is full.
16-binary_tree_is_perfect.c Write a function that checks if a binary tree is perfect.
17-binary_tree_sibling.c Write a function that finds the sibling of a node.
18-binary_tree_uncle.c Write a function that finds the uncle of a node.
100-binary_trees_ancestor.c Write a function that finds the lowest common ancestor of two nodes.
101-binary_tree_levelorder.c Write a function that goes through a binary tree using level-order traversal.
102-binary_tree_is_complete.c Write a function that checks if a binary tree is complete.
103-binary_tree_rotate_left.c Write a function that performs a left-rotation on a binary tree.
104-binary_tree_rotate_right.c Write a function that performs a right-rotation on a binary tree.
110-binary_tree_is_bst.c Write a function that checks if a binary tree is a valid Binary Search Tree.
111-bst_insert.c Write a function that inserts a value in a Binary Search Tree.
112-array_to_bst.c Write a function that builds a Binary Search Tree from an array.
113-bst_search.c Write a function that searches for a value in a Binary Search Tree.
114-bst_remove.c Write a function that removes a node from a Binary Search Tree.
115-O What are the average time complexities of those operations on a Binary Search Tree (one answer per line): Inserting the value n, Removing the node with the value n, Searching for a node in a BST of size n.
120-binary_tree_is_avl.c Write a function that checks if a binary tree is a valid AVL Tree.
121-avl_insert.c Write a function that inserts a value in an AVL Tree.
122-array_to_avl.c Write a function that builds an AVL tree from an array.
123-avl_remove.c Write a function that removes a node from an AVL tree.
124-sorted_array_to_avl.c Write a function that builds an AVL tree from an array.
125-O What are the average time complexities of those operations on an AVL Tree (one answer per line): Inserting the value n, Removing the node with the value n, Searching for a node in an AVL tree of size n.
130-binary_tree_is_heap.c Write a function that checks if a binary tree is a valid Max Binary Heap.
131-heap_insert.c Write a function that inserts a value in Max Binary Heap.
132-array_to_heap.c Write a function that builds a Max Binary Heap tree from an array.
133-heap_extract.c Write a function that extracts the root node of a Max Binary Heap.
134-heap_to_sorted_array.c Write a function that converts a Binary Max Heap to a sorted array of integers.
135-O What are the average time complexities of those operations on a Binary Heap (one answer per line): Inserting the value n, Extracting the root node, Searching for a node in a binary heap of size n.