Lab Report 5
Lab Report 5
DATA STRUCTURES
NAME: K. ABINASH
CLASS: CSE-D
REG NO: AUU23EGCSE118
LAB REPORT-5
Programs:
1. Write a C program to implement Binary Search Tree
(i) Insertion
(ii) Deletion
(iii) Traversals
#include <stdio.h>
#include <stdlib.h>
int main() {
struct Node* root = NULL;
root = insert(root, 50);
insert(root, 30);
insert(root, 20);
insert(root, 40);
insert(root, 70);
insert(root, 60);
insert(root, 80);
return 0;
}
2. Write a C program to implement the traversals of Binary Search Tree
using Recursive Functions
(i) Pre-Order
(ii) In-Order
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
int main() {
struct Node* root = NULL;
root = insert(root, 50);
insert(root, 30);
insert(root, 20);
insert(root, 40);
insert(root, 70);
insert(root, 60);
insert(root, 80);
return 0;
}
Conclusion:
The laboratory experiment demonstrated the implementation of the Queue ADT
and its application in DFS and BFS graph traversal algorithms. These
algorithms are fundamental in graph theory and are used in various applications
such as network routing, social network analysis, and pathfinding in games and
robotics.