Contest experience – Infosys CampusConnect Aspirations 2020


https://vishnuramesh.wordpress.com/wp-content/uploads/2011/09/infoysys.jpg?w=155This is the first time I’m taking part in a real programming contest. Had so much fun and learned a lot more. My teammates were Sai Vikneshwar (Third year CS) and Aswin Akhilesh (Fourth Year CS). They are really good at this. I’m glad I got this opportunity to work with them. At first I had doubts if I could keep up with them. But it turned out to be a really good learning experience. There were 7questions and 5hours. Within the first our we read all the problems and started with what we felt was the easiest and could be submitted. The problems were pretty tough. The lab was pretty much filled up in the beginning. The contest was a crash course on vectors for me. I had never used vectors before. Knew it was really cool. We had to work using an arena which they supplied. The interface was pretty lame. And we had to stick to a directory structure which they specified. That again was lame. I did not like the lack of freedom. For all the problems they had supplied a header file containing a class and a function. We just had to complete the function according to the given instructions. This was the first time I’m dealing with problems like this. In the problems which I’ve seen before we just had to get the output correct. Anyway we managed to solve one problem. It had no compilation errors and worked perfectly with all test cases we tried. But the arena just refused to accept our program. It was compiling our program as if it was a c program, but ours was cpp. Anyway I learnt a lot today. I was able to keep up with the code 😀 Great experience. The last time I sat five hours at a stretch in lab was for our end semester lab exam for C programming in S2. But back then the problems were simple and we were working on mooshak. I really admire mooshak. Its a really cool software and fun to work with. Mooshak gave me my first A+ grade 🙂

Oh I also learned a lot about pointers, scope of variables, debugging and is the first time I’m actually noticing varriables getting destructed when their scope ends.

Operator overloading


Using Operator overloading we can overload operators to work with the classes defined by us. For example: consider I have a class to store complex numbers. I may now overload the + – = operators to work with objects of my complex class the way these operators work with int or float data types. This enables me to add objects of complex data type using the + operator. Well its a lot like functions. The only difference I could figure out was that if you use operators instead of functions, you feel like the code is more abstracted. Moreover I think it’s really cool. But I’m sure that there must have been a more beautiful goal behind operator overloading.

Note that just like a function an operator also has to be called by an object.

I studied operator overloading using the following program.


// to study operator overloading by implementing a class on coordinates of a point in space
#include <iostream>
using namespace std;

class coords {
int x,y,z;
public:
coords() {
x=y=z=0;
}
coords( int a , int b , int c ) {
x=a;
y=b;
z=c;
}
void print() {
cout << "(" << x << "," << y << "," << z << ")" ;
}
coords operator+ (coords op2) {
coords temp;
temp.x = x + op2.x;
temp.y = y + op2.y;
temp.z = z + op2.z;
return temp;
}
coords operator-() {
x=-x;
y=-y;
z=-z;
return *this;
}
};

int main() {
coords p1(10,20,30);
cout << "p1.print()\t\t" ;
p1.print();
cout << endl;
coords p2(1,2,3);
cout << "p2.print()\t\t" ;
p2.print();
cout << endl;
coords p3;
cout << "p3.print()\t\t" ;
p3.print();
cout << endl;
p3 = p1 + p2;
cout << "p3 = p1 + p2" << endl;
cout << "p3.print()\t\t" ;
p3.print();
cout << endl;
p3 = - p3;
cout << "p3 = - p3" << endl;
cout << "p3.print()\t\t" ;
p3.print();
cout << endl;
p3 = p1 + p2 + p3;
cout << "p3 = p1 + p2 + p3" << endl;;
cout << "p3.print()\t\t" ;
p3.print();
cout << endl;
return 0;
}

Output:


p1.print()        (10,20,30)
p2.print()        (1,2,3)
p3.print()        (0,0,0)
p3 = p1 + p2
p3.print()        (11,22,33)
p3 = - p3
p3.print()        (-11,-22,-33)
p3 = p1 + p2 + p3
p3.print()        (0,0,0)

How to add Feedjit widget to your WordPress.com blog?


Feedjit location widget is an extremely cool widget which shows you details about your blog visitors. It shows the location of your blog’s visitor, the operating system which he or she used while visiting your blog, the time when he or she visited your blog and the browser used.

But feedjit’s site doesn’t give an option for wordpress.com bloggers on their home page. I eventually found something that works for wordpress.com users. I found this link in one of WordPress’ forums. Copy the code and paste it in your blog’s text widget. Wonder why they did not display it in their homepage.

Try it enjoy 🙂

The Python Challenge


Python ChallengeThe Python Challenge is an online programming puzzle. I do think it is possible to solve it without using any programming, but that ruins the fun part. This is a fun way to improve your programming skills. I am just learning python. So, I still don’t know how to do most of the basic things. With each level you learn something new. And while searching for the answer you learn some more. And you learn a lot more from your mistakes too. I do think it is possible to use any language other than python also to find solution. I found myself tempted to use C to find solutions rather than using python. But I stood my ground and sticked to my goal. My goal is to get better in python. I could do it with C but that doesn’t serve the purpose. They should have called it “The Programming Challenge” since there is no rule that you should stick to python and because the puzzle can be used to improve your skills in any language.

I reached level2 which is actually the third level. Crazy guy started counting from 0. There are 33 levels in total.

The game if very simple. The clues will be displayed on the web page. Once you solve the given hints, you’ll know how to reach the next level. Getting to the next level means modifying current level’s URL according to the hints provided. You’ll understand better if you try it.

In short, The Python Challenge is a lot of FUN + some programming + a lot of deductive thinking. If you’ve always wanted to go treasure hunting with real treasure and real clues, here is your chance.

Try it, Have fun 🙂

Apple iPad


iPadI was totally surprised when I saw message from my friend and teacher asking me, “Do you want an iPad to play with?”. I am an apple maniac. I’ve seen perfection in every apple product I’ve ever used. The message has left me excited. Cant wait to play with it. Of course I’ll put a review here.

An iPad is powered by a Dual core A5 chip. Apple promises a 10hours of play time at full charge. There are only 2mobile OS which I think are flawless, iOS4 and Android. iPad runs iOS4 which I think is the better of the two. There is no limit to what you can do with an iPad, there’s an app for everything. And there are millions of apps to choose from. I have used the iTouch before, I’m expecting the same flawless multi touch user interface. A 3axis gyro and an accelerometer makes it a great gaming device. And not to mention the high resolution screen.I started appreciating music when I got my first iPod. An apple experience is truly different and special.

22nd May 2011, 7:00pm

Its heavier than what I expected. Really heavy. But still just superb. The music player interface looks just like the one in iTunes(PC). Oh and one major addition to iPad2 – Multitasking! And the new covers are also great. You can place your iPad on the desk like a photo viewer. And the loud speakers are actually loud this time even though not loud enough. Unfortunately It did not have much apps or other content in it.

23rd May 2011, 1:30pm