C++ program to implement AVL Tree

An AVL tree is another balanced binary search tree. Named after their inventors, Adelson-Velskii and Landis, they were the first dynamically balanced trees to be proposed. Like red-black trees, they are not perfectly balanced, but pairs of sub-trees differ in height by at most 1, maintaining an O(logn) search time. Addition and deletion operations also take O(logn) time. Definition of…

Program Shortest Path using Kruskal algorithm in cpp

The following program illustrates Kruskal algorithm in cpp to find Shortest Path.   #include <iostream.h> #include <graphics.h> #include <string.h> #include <stdlib.h> #include <conio.h> #define MAX_VERTICES 10 #define MAX_EDGES 15 /*************************************************************************/ //——————————- Vertex ——————————// /*************************************************************************/ class Vertex { public: int x; int y; int label; private: char Label[5]; public: Vertex( ) { } ~Vertex( ) { } void SetVertex(const int,const int,const…

Program for Shortest path using Dijkstra Algorithm in c++

The following program illustrates the Shortest Path using Dijkstra Algorithm in C++:   #include <iostream.h> #include <conio.h> #define MAX_NODE 50 struct node{ int vertex; int weight; node *next; }; struct fringe_node{ int vertex; fringe_node *next; }; node *adj[MAX_NODE]; //For storing Adjacency list of nodes.int totNodes; //No. of Nodes in Graph.constint UNSEEN=1,FRINGE=2,INTREE=3; //status of node.int status[MAX_NODE];//status arr for maintaing status. fringe_node…