0
3.7kviews
Write a program to implement Binary search Tree. Show BST of the following 10, 5, 4,12, 15, 11, 3
1 Answer
| written 7.2 years ago by |
Program for BST
#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); …