Binary Search Tree and all traversals
#include <stdio.h> #include <stdlib.h> struct node { int key; struct node *left, *right; }; struct node* newNode(int item) { struct node* temp = (struct node*)malloc(sizeof(struct node)); temp->key = item; temp->left = temp->right = NULL; return temp; } void inorder(struct node* root) { if (root != NULL) { inorder(root->left); printf("%d ", root->key); inorder(root->right); } } void preorder(struct node* root) { if (root != NULL) { printf("%d ", root->key); pre order(root->left); pre order(root->right); } } void postorder(struct node* root) { if (root != NULL) { post order(root->left); post order(root->right); printf("%d ", root->key); } } struct node* insert(struct node* node, int key) { if (node == NULL) return newNode(key); if (key < node->key) node->left = insert(node->left, key); else if (key > node->key) node->rig...