Menu
Coddy logo textTech

Clase AVLTree

Lección 4 de 16 del curso Árbol AVL - Serie de Estructuras de Datos #10 de Coddy.

La clase AVLTree agrupa todo. Contiene un único campo: root, un puntero al Node superior del árbol (o null cuando el árbol está vacío).

Cada método que escribas a partir de aquí depende de esta clase y comienza, directa o indirectamente, desde root.

challenge icon

Desafío

Principiante

Escribe una clase AVLTree con un constructor que establezca root a null.

Pruébalo tú mismo

#include <stdio.h>
#include <string.h>
#include "avltree.h"

int main(void) {
    AVLTree* tree = AVLTree_create();
    char line[256];
    while (fgets(line, sizeof(line), stdin) != NULL) {
        line[strcspn(line, "\r\n")] = '\0';
        if (strcmp(line, "empty") == 0) {
            if (tree->root == NULL) {
                printf("true\n");
            }
            if (tree->root != NULL) {
                printf("false\n");
            }
        }
    }
    return 0;
}

Todas las lecciones de Árbol AVL - Serie de Estructuras de Datos #10