Wednesday, April 20, 2016

I am more than Tourist.

Read more books/blog/paper/code about programming/algorithm/math. --Knowledge is power.

Solve more problems, solve harder problems. --People shall go up.

Improve coding skill & coding style. --Code shall be elegant.

Try to solve problem in more ways & in better ways. --Use suitable strategies to beat different problems.

Keep some useful code in your library. --Keep swords in your disk.

Test before submission, wait for WA and get AC. --Be calm, careful, confident & competitive.

Set some rational goals & make great efforts. --Step to your further goal.

Be happy and take exercises. Go out and say 'Now I'm more than tourist.'. --Never code sick code, never code unhappy code.
Love coding, love solving problems. --Coder shall be coder.

Sunday, April 17, 2016

string -1


int main()
{
    string a, b, c;
    a = "this is a string"; // easy assigning
    b = a; // copy hoye gelo! :O
    c = a + b // c te rakhlam a ar b er concatation
        cout << c << endl; // print korlam
    printf("%s\n", c.c_str() ); // printf diyei korlam na hoy

    cout << c.size() << endl; // length print korlam
    for(int i=0; i<c.size(); i++) cout << c[i] ;
// ekta ekta kore character print korlam

    return 0;
}


VECTOR

Different uses of vector:  ভেক্টরের মায়েরে বাপ


note:

  • The push_back( ) member function inserts value at the end of the vector, expanding its size as needed.
  • The size( ) function displays the size of the vector.
  • The function begin( ) returns an iterator to the start of the vector.
  • The function end( ) returns an iterator to the end of the vector.

use of vector:

#include <iostream>
#include <vector>
using namespace std;
 
int main()
{
   // create a vector to store int
   vector<int> vec; 
   int i;

   // display the original size of vec
   cout << "vector size = " << vec.size() << endl;

   // push 5 values into the vector
   for(i = 0; i < 5; i++){
      vec.push_back(i);
   }

   // display extended size of vec
   cout << "extended vector size = " << vec.size() << endl;

   // access 5 values from the vector
   for(i = 0; i < 5; i++){
      cout << "value of vec [" << i << "] = " << vec[i] << endl;
   }

   // use iterator to access the values
   vector<int>::iterator v = vec.begin();
   while( v != vec.end()) {
      cout << "value of v = " << *v << endl;
      v++;
   }

   return 0;
}

ref: tutorial points

Thursday, April 7, 2016

Code for nCr

///Bis-millah-hir-rahmanir-rahim
///arafat,sylhet engineering college,Bangladesh.

///  **************code for nCr****************

/// expression of nCr or C(n,r) =  c(n-1,r) + c(n-1,r-1)

#include<bits/stdc++.h>
using namespace std;


int com(int n, int r)
{
    if(n==r) return 1;
    if(r==1) return n;
    return com(n-1,r) + com(n-1,r-1);
}

int main()
{
    int n,c,r;
    cin>>n>>r;
   c= com(n,r);
   cout<<c;


    return 0;
}

Speedup Android Studio

Go to Help ->Edit Custom VM Options, and chnge this 4 setting. After that close your Android Studio. This settings are for 8gb of ram pc...