> 2 ex01: ft_btree_insert_data // Write recursive insert... // Submit Moulinette: KO (segfault) // Debug: forgot to malloc node // Resubmit Moulinette: OK (4/4)
Do not use recursion here — unnecessary and slower. 2. ft_list_remove_if (Medium) void ft_list_remove_if(t_list **begin_list, void *data_ref, int (*cmp)()) 42 Exam Rank 03
5 / \ 3 8 / \ \ 1 4 9 Trace ft_btree_apply_infix (left-root-right). Write the output before running code. Give yourself 20 minutes per exercise. If you exceed, look at the solution, understand it, then redo from scratch. 4. Understand the typedefs typedef struct s_list > 2 ex01: ft_btree_insert_data // Write recursive insert
if (!node) return; // do something with node traverse(node->left); traverse(node->right); If you exceed, look at the solution, understand
> 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.
> 2 Available exercises: ex00: ft_list_size (2 pts) ex01: ft_btree_insert_data (4 pts) ex02: ft_itoa_base (4 pts)
// remove from front