

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Name: Reg. No: ___
class graphWithArrays { protected: int **G; unsigned int size; int *visit; public: graphWithArrays(unsigned int x); void storeGraph(); void printGraph(); void DFS (int v); }; class btree { protected: int *p; // array of values int *f; // array of flag unsigned int size; public: btree(unsigned int s) { int i; p = new int [s]; f = new int [s]; size = s; for (i=0; i<s; ++i) f[i] = 0; } int Find(int v); // Find value element v node in the binary tree. if found //return the index of the location where it is found. Otherwise, return - 1 int findCousine(int v) // find index of the cousin of the node with index v (whose //grandparent is same PostOrderVisit (int v) // A function to visit the tree in post order, starting from //node with index v, };
Name: Reg. No: ___
class bstree { protected: int *p; // array of values int *f; // array of flag unsigned int size; public: bstree(unsigned int s) { int i; p = new int [s]; f = new int [s]; size = s; for (i=0; i<s; ++i) f[i] = 0; } int insert(int v); //insert value v in the BST, and return 1 if it is inserted properly //otherwise return 0 int search(int v); // search value element v at the proper position in BST. if found //return the index of the location where it is found. Otherwise, return - 1 };