পোস্টগুলি

জানুয়ারী, ২০১৮ থেকে পোস্টগুলি দেখানো হচ্ছে

SPOJ-INVERSE-SORT

Problem Algorithm: We have to generate  10!  combination of " abcdefghij  " by reversing and put appropriate distance from " abcdefghij  " So we need  key(string)->value  data structure. First thing comes to our mind is map<string,int> But it uses O(logN) time to insert a value as everything is ordered here So we use unordered_map ( Normally o(1) highest o(n) barely )  After that we take 2 string input and then find the relative string S from s1->s2 and another AC!! CODE Time needed 40-45sec .

C++ Class

ছবি
> Abstraction >E ncapsulation   /Access Modifiers >Inheritance #include <iostream> using namespace std; class vehicle { public:     vehicle()     {         cout<<"this is a constructor of vehicle"<<endl;     }     ~vehicle()     {         cout<<"this is a deconstructor of vehicle"<<endl;     } }; class fourwheeler { public:     fourwheeler()     {         cout<<"this is the constructor of fourwheeler"<<endl;     }     fourwheeler(string x)     {         cout<<"This is another constructor which has "<<x<<" with it"<<endl;     }     ~fourwheeler()     {         cout<<"this is deconstructor of fourwheeler"<<endl;     } }; //Single Inheritanc e class Car: public vehicle {     public:     Car()     {         cout<<"this is a derrived child class from vehicle 's constructor"&l