if (!root) return (0); return (1 + max(ft_btree_level_count(root->left), ft_btree_level_count(root->right)));
int count = 0; while (begin_list) count++; begin_list = begin_list->next; return (count);
> 5 EXAM FINISHED. Grade: SUCCESS. Exam Rank 03 is the first real test of algorithmic thinking in the 42 curriculum. It separates those who understand recursion from those who just copy-paste. Practice the binary tree exercises until they become muscle memory. Remember: Every recursive function has a base case (usually NULL ) and a recursive step. Master that, and Rank 03 becomes a stepping stone, not a stumbling block.
t_btree *node; struct s_queue *next; t_queue; void enqueue(t_queue **q, t_btree *node)
if (cmp(current->data, data_ref) == 0) if (previous) previous->next = current->next; else *begin_list = current->next; free(current); current = previous ? previous->next : *begin_list; else previous = current; current = current->next;
Total: 10/8. PASS.