Wa0020.
Wa0020.
. Date :
27/12/23
Name:Likhitha Reddy
roll no : 22r21a0424
section : ece A
1.problem ststement
Develop a C Program to Create Binary search tree with the following elements: 78,
54,34,90,11,56,98,101,44,13,35,87 and perform search operation to search an element 101 .
program
#include <stdio.h>
#include <stdlib.h>
struct Node {
int data;
};
newNode->data = value;
newNode->left = NULL;
newNode->right = NULL;
return newNode;
if (root == NULL)
return createNode(value);
if (value < root->data)
return root;
return root;
else
int main() {
int elements[] = {78, 54, 34, 90, 11, 56, 98, 101, 44, 13, 35, 87};
if (result != NULL)
else
return 0;
}
4.problem statement
Develop a C program to perform the following operations on AVL tree
program
#include <stdio.h>
#include <stdlib.h>
struct Node {
};
return (a > b) ? a : b;
node->key = key;
return node;
return x;
return y;
node->left = leftRotate(node->left);
return rightRotate(node);
}
node->right = rightRotate(node->right);
return leftRotate(node);
return node;
int main() {
if (searchResult != NULL)
else
return 0;