Одиннадцать лет я думал, что у меня есть семья. Жена, двое детей, дом, жизнь, которая со стороны казалась абсолютно обычной. Мы ужинали вместе, занимались повседневными делами, ходили на школьные мероприятия детей. Идеальная рутина.
Но где-то в глубине души я знал: что-то не так.
В какой-то момент мы с женой перестали быть парой. Мы не были ни партнёрами, ни влюблёнными. Даже врагами. Просто два чужих человека под одной крышей, связанных лишь бытовыми обязанностями. Мы не ссорились, но и не разговаривали. Наши диалоги стали механическими счета, покупки, расписание детей.
И я привык. Потому что так было удобно.
Пока не встретил её.
Другую женщину. Тёплую, живую, полную энергии. Она смотрела на меня так, будто я был единственным мужчиной на свете. Я пытался об# 0x0D. Array to AVL
## Requirements
### General
– Allowed editors: `vi`, `vim`, `emacs`
– All your files will be compiled on Ubuntu 14.04 LTS
– Your programs and functions will be compiled with `gcc 4.8.4` using the flags `-Wall` `-Werror` `-Wextra` and `-pedantic`
– 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](https://github.com/holbertonschool/Betty/blob/master/betty-style.pl) and [betty-doc.pl](https://github.com/holbertonschool/Betty/blob/master/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 dont have to push them to your repo (if you do we wont take them into account). We will use our own `main.c` files at compilation. Our `main.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`
– Dont forget to push your header file
– All your header files should be include guarded
—
## Tasks
### [0. AVL – From sorted array](./0-sorted_array_to_avl.c)
Write a function that builds an AVL tree from an array
– Prototype: `avl_t *sorted_array_to_avl(int *array, size_t size);`
– Where `array` is a pointer to the first element of the array to be converted
– And `size` is the number of element in the array
– Your function must return a pointer to the root node of the created AVL tree, or `NULL` on failure
– You can assume there will be no duplicate value in the array
– You are not allowed to rotate
– You can only have 3 functions in your file
Your file `0-sorted_array_to_avl.c` will be compiled with the following command:
“`
$ gcc -Wall -Wextra -Werror -pedantic binary_tree_print.c 0-main.c 0-sorted_array_to_avl.c -o 0-sorted_array_to_avl
“`
“`
alex@/tmp/binary_trees$ cat 0-main.c
#include 
#include 
#include “binary_trees.h”
/**
 * print_array – Prints an array of integers
 *
 * @array: The array to be printed
 * @size: Size of the array
 */
void print_array(const int *array, size_t size)
{
    size_t i;
for (i = 0; i < size; ++i) printf("(%03d)", array[i]); printf("\n"); } /** * main - Entry point * * Return: 0 on success, error code on failure */ int main(void) { avl_t *tree; int array[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }; size_t n = sizeof(array) / sizeof(array[0]); tree = sorted_array_to_avl(array, n); if (!tree) return (1); print_array(array, n); binary_tree_print(tree); return (0); } alex@/tmp/binary_trees$ ./0-sorted_array_to_avl (001)(002)(003)(004)(005)(006)(007)(008)(009)(010)(011)(012)(013)(014)(015)(016)(017)(018)(019)(020)(021)(022)(023)(024)(025)(026)(027)(028)(029)(030)(031) .----------------------------(016)-------. .-------(008)-------. .-------(024)-------. .--(004)--. .--(012)--. .--(020)--. .--(028)--. (002) (006) (010) (014) (018) (022) (026) (030) (001) (003) (005) (007) (009) (011) (013) (015) (017) (019) (021) (023) (025) (027) (029) (031) alex@/tmp/binary_trees$ ``` --- ## Author * **Arturo Victoria Rincon** - [arvicrin](https://github.com/arvicrin)


