So i don't really understand how I will calculate the time complexity for my code, I've had a hard time with it and I would really need some help.
the exponent is N all the time. So how will i find the time complexity in N-time(bits)..
for(int i = 0; i < powerup(2, exponent); i++)
{
candenc = KEYsubsetsum(candidate, T);
m.insert(pair<Key, Key>(candenc, candidate));
candidate++;
}
ckey = candidate;
do
{
candenc = KEYsubsetsum(candidate, T);
if(mkey.find(encrypted-candenc) -> first + candenc == encrypted)
{
auto range = mkey.equal_range(encrypted-candenc);
for(multimap<Key,Key>::iterator it=range.first; it!=range.second; ++it)
cout << candidate + it->second << endl;
}
candidate = candidate + contkey;
} while (candidate != zero);
auto end = chrono::high_resolution_clock::now();
cout << "Decryption took "
<< std::chrono::duration_cast<chrono::seconds>(end - begin).count()
<< " seconds." << endl;
return 0;
}
zangazanga 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.