C
Group project
Algorithm
Data structure
- Allowed editors:
vi
,vim
,emacs
- All your files will be compiled on Ubuntu 20.04 LTS using gcc, using the options -Wall -Werror -Wextra -pedantic -std=gnu89
- All your files should end with a new line
- A
README.md
file, at the root of the folder of the project, is mandatory - Your code should use the
Betty
style. It will be checked using betty-style.pl and betty-doc.pl - You are not allowed to use global variables
- No more than 5 functions per file
- You are allowed to use the standard library
- In the following examples, the
main.c
files are shown as examples. You can use them to test your functions, but you don’t have to push them to your repo (if you do we won’t take them into account). We will use our ownmain.
c files at compilation. Ourmain.c
files might be different from the one shown in the examples - The prototypes of all your functions should be included in your header file called
binary_trees.h
- Don’t forget to push your header file
- All your header files should be include guarded
There should be one project repository per group. If you clone/fork/whatever a project repository with the same name before the second deadline, you risk a 0% score.
Please use the following data structures and types for binary trees. Don’t forget to include them in your header file.
/**
* struct binary_tree_s - Binary tree node
*
* @n: Integer stored in the node
* @parent: Pointer to the parent node
* @left: Pointer to the left child node
* @right: Pointer to the right child node
*/
struct binary_tree_s
{
int n;
struct binary_tree_s *parent;
struct binary_tree_s *left;
struct binary_tree_s *right;
};
typedef struct binary_tree_s binary_tree_t;
typedef struct binary_tree_s bst_t;
typedef struct binary_tree_s avl_t;
typedef struct binary_tree_s heap_t;
Note: For tasks 0 to 23 (included), you have to deal with simple binary trees. They are not BSTs, thus they don’t follow any kind of rule.
To match the examples in the tasks, you are given this function
This function is used only for visualization purposes. You don’t have to push it to your repo. It may not be used during the correction
mandatory
File: 0-binary_tree_node.c
mandatory
mandatory
mandatory
mandatory
mandatory
mandatory
File: 3-binary_tree_delete.c
mandatory
mandatory
File: 4-binary_tree_is_leaf.c
mandatory
mandatory
File: 5-binary_tree_is_root.c
mandatory
mandatory
File: 6-binary_tree_preorder.c
mandatory
mandatory
File: 7-binary_tree_inorder.c
mandatory
mandatory
mandatory
mandatory
File: 9-binary_tree_height.c
mandatory
mandatory
File: 10-binary_tree_depth.c
mandatory
mandatory
File: 11-binary_tree_size.c
mandatory
mandatory
File: 12-binary_tree_leaves.c
mandatory
mandatory
File: 13-binary_tree_nodes.c
mandatory
mandatory
File: 14-binary_tree_balance.c
mandatory
mandatory
File: 15-binary_tree_is_full.c
mandatory
mandatory
mandatory
mandatory
File: 17-binary_tree_sibling.c
mandatory
mandatory
File: 18-binary_tree_uncle.c
mandatory
#advanced
#advanced
#advanced
#advanced
#advanced
#advanced
#advanced
#advanced
#advanced
#advanced
#advanced
File: 110-binary_tree_is_bst.c
#advanced
#advanced
#advanced
#advanced
File: 112-array_to_bst.c, 111-bst_insert.c, 0-binary_tree_node.c
#advanced
#advanced
File: 113-bst_search.c
#advanced
#advanced
File: 114-bst_remove.c
#advanced
#advanced
File: 115-O
#advanced
#advanced
File: 120-binary_tree_is_avl.c
#advanced
#advanced
File: 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
#advanced
#advanced
File: 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
#advanced
#advanced
File: 123-avl_remove.c, 14-binary_tree_balance.c, 103-binary_tree_rotate_left.c, 104-binary_tree_rotate_right.c
#advanced
#advanced
#advanced
#advanced
File: 125-O
#advanced
#advanced
#advanced
#advanced
#advanced
#advanced
File: 132-array_to_heap.c, 131-heap_insert.c, 0-binary_tree_node.c
#advanced
#advanced
File: 133-heap_extract.c
#advanced
#advanced
#advanced
#advanced
File: 135-O
#advanced