#include<iostream>#include<cstdlib>#include<vector>using namespace std;class keyword { // uncomment 1st n 3rd line, later //string original_keyword; // actual keyword int hashed_keyword; // hash value of keyword which you hav to compare //vector<int> indexes; public: keyword(); keyword(int); int get_HKW(); //get Hashed Key Word static vector<keyword> HKWsearch_insert( vector<keyword> V, int hashed_input); void initialize(int); // just for time sake... to be deleted };keyword::keyword(){}keyword::keyword(int value){ keyword::hashed_keyword=value;}void keyword::initialize(int value){ keyword::hashed_keyword=value;}int keyword:: get_HKW() { return keyword::hashed_keyword;} vector<keyword> keyword:: HKWsearch_insert( vector<keyword> V, int hashed_input){ keyword temporary(hashed_input); //cout<<"enter the keyword\n"; //string keyworde; //cin>>keyworde; //sample_one.original_keyword=keyworde; //hash it and//searching partint l=0,h=V.size()-1;int temp,mid,pos;while(l<h) { mid = ( h+l ) /2; if ( h == l) //index of the last element compared by binary search { if( V[h].get_HKW() == hashed_input ) { temp = h; while( V[temp].get_HKW() == hashed_input ) temp++; pos = temp; // pos to insert new hashed_input goto insert; } if ( V[h].get_HKW() < hashed_input) { temp = h+1; while( V[temp].get_HKW() == V[h].get_HKW()) temp++; pos = temp; // pos to insert new hashed_input goto insert; } if( V[h].get_HKW() > hashed_input ) { temp = h-1; //possible pos to insert new hashed_input while( V[temp].get_HKW() == V[h].get_HKW() ) temp--; pos = temp; goto insert; } } if(V[mid].get_HKW() == hashed_input) { pos = (mid+1); goto insert; } if(V[mid].get_HKW() < hashed_input) l=mid+1; if(V[mid].get_HKW()> hashed_input) h=mid-1; } // end of whileinsert:int temp1;temp1= V.size();V.resize(V.size()+1); while( temp1 >= pos) { V[temp1+1]=V[temp1]; temp1--; } V[temp1]= temporary ; //copying classes}int main() // later rename main() appropriately n put into library{ int hashed_input= 250 ; // remove later/* i will create a pseudo keyword * objects to test the function * delete this portion later*/ vector<keyword> V(20); //works only when there is a default constructor else // vetor <keyword> V(200, keyword(/*arguments for constructor */)); // use a vector of size 1. (not 200) As real database is built, it is resized with each insertion for(int i=0; i<20 ; i++) { V[i].initialize(i+100); //current no. of elements(a static member of V) }keyword::HKWsearch_insert( V, hashed_input);for (int i=0;i<V.size();i++)cout<<V[i].get_HKW()<<" ";}