int main() { // {"10001", "011", "100", "001", "10"} // {"1010", "11", "100", "0", "1011"} std::vector<string> v; v.push_back("1010"); v.push_back("11"); v.push_back("100"); v.push_back("0"); v.push_back("1011"); PrefixCode pc; cout << pc.isOne(v) << endl; return 0; }
int main() { PrefixCode x; vector<string> v; v.push_back("10001"); v.push_back("011"); v.push_back("100"); v.push_back("001"); v.push_back("10"); string a = x.isOne(v); cout << a << endl; return 0; }
double test1() { string t0[] = {"10001", "011", "100", "001", "10"}; vector <string> p0(t0, t0+sizeof(t0)/sizeof(string)); PrefixCode * obj = new PrefixCode(); clock_t start = clock(); string my_answer = obj->isOne(p0); clock_t end = clock(); delete obj; cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl; string p1 = "No, 2"; cout <<"Desired answer: " <<endl; cout <<"\t\"" << p1 <<"\"" <<endl; cout <<"Your answer: " <<endl; cout <<"\t\"" << my_answer<<"\"" <<endl; if (p1 != my_answer) { cout <<"DOESN'T MATCH!!!!" <<endl <<endl; return -1; } else { cout <<"Match :-)" <<endl <<endl; return (double)(end-start)/CLOCKS_PER_SEC; } }