In-order Traversal
Lección 8 de 13 del curso Árbol Binario - Serie de Estructuras de Datos #3 de Coddy.
Desafío
FácilRecorrido in-order:
- Recorrer el subárbol izquierdo
- Visitar la raíz
- Recorrer el subárbol derecho
Añade a BinaryTree el método inOrderPrint que imprima los valores en orden, cada uno seguido de un espacio.
Pruébalo tú mismo
#include <stdio.h>
#include <string.h>
#include "binarytree.h"
int main() {
char buf[4096];
if (!fgets(buf, sizeof(buf), stdin)) buf[0] = '\0';
buf[strcspn(buf, "\r\n")] = '\0';
BinaryTree bt;
BinaryTree_init(&bt);
BinaryTree_buildTree(&bt, buf);
BinaryTree_inOrderPrint(&bt);
return 0;
}
Todas las lecciones de Árbol Binario - Serie de Estructuras de Datos #3
2Binary Tree Project
Node ClassNode with Sons