hima890 / binary_trees

A collection of C programs for learning and implementing binary tree operations, including traversal, insertion, deletion, and validation. Ideal for understanding fundamental data structures and algorithms in C programming.
GNU General Public License v3.0
0 stars 0 forks source link

6. Pre-order traversal #7

Closed hima890 closed 5 months ago

hima890 commented 5 months ago

Write a function that goes through a binary tree using pre-order traversal

Prototype: void binary_tree_preorder(const binary_tree_t tree, void (func)(int)); Where tree is a pointer to the root node of the tree to traverse And func is a pointer to a function to call for each node. The value in the node must be passed as a parameter to this function. If tree or func is NULL, do nothing alex@/tmp/binary_trees$ cat 6-main.c

include

include

include "binary_trees.h"

/**

/**

hima890 commented 5 months ago

This one seems a litel bit hard