Sunday, May 13, 2012

Still Suffering.....














socha tha 1st Year me kar lo thodi padhai,
 2nd year me to karna h bhot aaram,
magar kitni galat soch thi meri,
4th sem me ho gaya h jeena haraam.


kal tak sirf Counter Strike ke liye use kiya karte the computer ki hard disk aur RAM,
aaj usi computer pe compile karte h Heapsort aur Binary tree ke programs,
proxy banane ke alawa aur kuch bhi nahi aata tha,
ab Resume bhi likh lete h , A very big thanks to english waali maam,

padh padh kar Discrete Maths ke algebraic structure
ho gaye hum Total ghanchakkar,
padh kar computer ke bits and bytes,
badal gaya h dimag ka Memory Structure.


padh-padh kar Phonetics ban gaye hum total angrez,
hindi to bhul hi gaye h, chad gaya h videshi bhashao ka craze,

Recursive tree ke recursion ne , kar diya life ka destruction,
bolne ko kuch bacha nahi, But we are supporting Anna against corruption.

padh lo Cormen samaj me aa jayega Algorithm and Shortest path,
darne ki kya h baat jab tak uparwale ka h apne sir pe hath,
aur ho sakta h humari branch me bhi mass bunk,
bas mil jaye ek baar branch ke toppers ka sath,...............


Copyright © 2012 Piyush Golani All Rights Reserved

Saturday, May 12, 2012

The Facebook Fever


socha tha garmiyo ki chuttiyo me padhunga C++ ki book,
lekin subah hote hi computer par khul jata h facebook..
Notifications me hi duniya simat gayi h meri,
frustration mein i give myself a very dirty look...

koi likhta h LOVE is everything,
koi likhta h Love is fake,
aur koi likhta h Janu wapas aa jao,...
i wanna dive into your eyes.. coz ur eyes are much deeper than a lake...

dost hua from 'Single' to 'In a relationship'
aur likha 'I cant live without seing her face'..
2 weeks later back from 'In a relationship' to 'Single'
aur likha 'she took from me my freedom and space'...

jo bhi kaho Facebook made my mind fully paralysed and lame,
but still i get very happy when in the chat box ,
i see a green dot beside her name.. ;-)



Copyright © 2012 Piyush Golani All Rights Reserved

Getting started on Topcoder..


hey guys, this post is about how to get started on one of the biggest coding site Topcoder. You must have observed that this is not an ordinary coding site like codechef and codeforces where you can just open a problem and submit your solution. This is because of the following two reasons.....

1. Topcoder has a java applet called Arena on which you can write your code and after then compile and test your code against the various test cases.

2. Topcoder allows only Object-Oriented Languages like C++, Java, C99 etc . This means that if you are a C coder then you must shift to C++ in order to compete on topcoder.

Before beginning let me tell you that topcoder hosts a number of Algorithmic competitions and the most common among them are SRMs (Single Round Matches)...

Now do the following steps........

1. Open the Topcoder website.

2. Register yourself on the site. If you are already registered then simply click on the 'Go to Community Portal' link on the top-right of the page.

3. Now on the top-left corner of the new page you would observe a lot of symbols... Click on 'O(n)' symbol. when u place your mouse pointer on it you would see 'Algorithm Competitions' appearing below.

4. On the new window click on the red button which says 'Load Competition Arena'. A '.jnlp' file would be downloaded. Now Launch this Java file and after a few seconds you would notice a beautiful arena appearing on your screen..

5. Simply enter your Username and Password and click on the 'go' button. Now you are ready to code, practise and compete.  Below picture shows a view of the Arena after you login in.....


Now i would suggest you to observe the various functionalities of the Arena by clicking on various buttons..

Do write your comments below and dont forget to click on the 'g+' button if u liked the post.......

Senior hai Duffer...



pee rahi thi Maaza jab tum khadi sudha pe,

dekhkar upar kaha meine khuda se,

Oh my God banane me ise laga hoga aapko bhot time,

dekhkar adaye unki my heart feels so fine,

overflow karne laga tha mere dil ka buffer,


peeche se dost bola "Abe Senior h duffer",,,,,,,,,,,,,,


Copyright © 2012 Piyush Golani All Rights Reserved

Thursday, May 3, 2012

String to Int ----- Int to String (some functions and their uses)

In many programming problems the input is given in string format and we have to extract int values from that for our manipulation... also sometimes we have to output some int in the form of a string .... following are the methods by which this task can be accomplished.....

1. Conversion from string to int 
suppose we are given a string time= "20:12:33";
int hour,min,second;
sscanf(time.c_str(),"%d:%d:%d",&hour,&min,&second);
now after the execution of above statement ,
 hour= 20, min= 12, second= 33

2. Conversion from string to int (when string is a set of two or more space separated strings)
suppose we have a string info= "Alice 20 M 125";
the above string consists of three strings(space separated) "Alice" , "20", "M", "125"
firstly include a header file..... #include<sstream>
make a declaration in your code istringstream is(info);
the example is shown below.....
#include<iostream>
#include<sstream>

void demo(string info)
                                                               {
istringstream is(info);
string name;
int age , id;
char sex;
is>>name; // name= Alice
is>>age; // age=20
is>>sex; // sex= M
is>>id; //id= 125
                                                                }


3. Conversion from int to string 
include a header file #include<sstream>,
example is shown below.......
#include<iostream>
#include<sstream>

                                                            void demo()
                                                           {
int hh=10, mm= 9, ss= 23;
                                                            stringstream t;
                                                            string time;
                                                            t<<hh<<":"<<mm<<":"<<ss;
                                                            time= t.str();// time= "10:9:23"
                                                            }



4. snprintf() in c++
#include<iomanip>
int totalrank=5;
double total= 234;
string name= "Piyush";
char buf[150];
vector<string> ans;
ans.clear();
snprintf(buf , sizeof(buf) , "%s %d %0.1f", name.c_str() , totalrank , total);
ans.push_back(buf);
cout<<ans[0];
the output would be......
Piyush 5 234.0