Zum Inhalt springen

Exam Rank 03: 42

> 2 ex01: ft_btree_insert_data // Write recursive insert... // Submit Moulinette: KO (segfault) // Debug: forgot to malloc node // Resubmit Moulinette: OK (4/4)

You need a pointer to pointer begin_list because the head may change. 3. ft_itoa_base (Classic tricky one) char *ft_itoa_base(int value, int base) 42 Exam Rank 03

| Exercise | Difficulty | Data Structure | Recursion Required? | |----------|------------|----------------|----------------------| | ft_list_size | Easy | Singly linked list | No (iterative) | | ft_list_push_back | Easy | Singly linked list | No | | ft_list_last | Easy | Singly linked list | No | | ft_list_foreach | Easy | Singly linked list | No | | ft_list_remove_if | Medium | Singly linked list | No | | ft_list_reverse | Medium | Singly linked list | No | | ft_list_sort | Medium-Hard | Singly linked list | Optional | | ft_list_merge | Medium | Singly linked list | No | | ft_itoa_base | Medium | String (no struct) | No (but tricky) | | ft_atoi_base | Medium | String (no struct) | No | | ft_split_whitespaces | Easy | String → array | No | | ft_range | Easy | Array | No | | ft_ultimate_range | Easy | Array | No | | ft_strjoin | Easy | String | No | | ft_btree_create_node | Easy | Binary tree | No | | ft_btree_apply_prefix | Medium | Binary tree | Yes | | ft_btree_apply_infix | Medium | Binary tree | Yes | | ft_btree_apply_suffix | Medium | Binary tree | Yes | | ft_btree_insert_data | Hard | Binary tree | Yes | | ft_btree_search_item | Medium | Binary tree | Yes | | ft_btree_level_count | Medium | Binary tree | Yes | | ft_btree_apply_by_level | Hard | Binary tree | Yes (with queue) | When you start Rank 03: > 2 ex01: ft_btree_insert_data // Write recursive insert

typedef struct s_queue

if (!node) return (NULL); if (cmp(node->item, ref) == 0) return (node->item); void *left = search(node->left, ref, cmp); if (left) return (left); return (search(node->right, ref, cmp)); ref) == 0) return (node-&gt

> 1 (to start ex00)