Monday, December 12, 2011

divisibility by 7

Hi, recently i came across a problem where it was required to check if a number is divisible by 7 . Though quiet an elementary task, i think its not very commonly known. This is what i found.
Test 1:
Reverse the number . Mulitply each digit of this reversed number by the digits 1(=1%7),3(=10%7),2(=100%7),6(=1000%7),4(=10000%7),5(=100000%7) consequtively till all digits are covered. Sum the products. If this value is divisible by 7 then the original number is too.
Actually these numbers are the cyclic remainders of division by 7.
Test 2:
Take the last digit of the number and subtract it from the number formed by the remaining digits.If this value is divisible by 7 then the original number is too. We can do it recursively to reduce the number .

Hope that helps.

Thursday, October 20, 2011

Pointers

Hi, recently came across an article which through some questions, has great explanation of pointers . They show that arrays are not pointers which is common pitfall.
Here's the link:
Pointers
Njoy reading. :)

Tuesday, October 18, 2011

Adding Javadoc of a jar in eclipse

Hi, recently i was facing with this problem of how to add the javadoc files of a jar in eclipse. I used netbeans earlier in which it was a simple process but here its not so straightforward.
First go to configure build-path of the project and select the jar in libraries tab. On expanding the jar file add the javadoc location to it and you'r done.
Hope its hopeful.

Monday, September 5, 2011

Some pearls of wisdom

Recently i came across few articles which were very inspiring especially for programmers.
They generally are concerned about how one must learn a language, start programming and ask relevant questions
Here are the links:

How to ask the smart way
Short simple examples
Why everyone's in a rush?

Hope it was useful.

Friday, September 2, 2011

Finding the shortest distance connecting 3 points

I came across another interesting problem, THREETW1 in spoj, thanks to hwk . Here we need to calculate the co-ordinates of the point which connects 3 points in shortest path.
For this problem we need to find the Fermat point . We first calculate the barycenter of this point from the sides of the triangle and then represent it in cartesian form.
This problem has application in finding the point where 3 points would be linked most efficiently , specially in cable wires and telephones.
Happy coding!!

Saturday, August 13, 2011

Finding whether a point lies inside a polygon

Hi, it's been a really loong break. Well after getting into the corporate world, you hardly get time!
I recently came across a problem TETRAHED in SPOJ which asks us to find whether a point lies inside a tetrahedron or not.
It seems quiet an interesting problem as the solution can be extended to any polygon.
In this we need to find the barycenters of the required point and then check the signs of the barycenters. If they are same then we can say that the point lies inside the region.
The problem has its application in geometric modelling and in graphics.
Enjoy!!
IMPORTANT LINKS:
1.My DISCUSSION
2.triangle centers
3 tutorial

Monday, April 25, 2011

Down the memory lane...

I feel quiet sentimental as i write this. Its been 4 winks of time since i stepped into a place , getting where needs you to beat around 350000 more aspiring candidates. As i appeared today for the very last time for my semester exam i felt that this can't be it. I mean how could it end just like this , would there be no more bunking classes,tests, no Ctrl+C followed by Ctrl+V ?? Was this the end ?
After i finished the exams and stepped out of the academic building,I stood there in a haze just gazing at it. The very place, getting into was something big for me 4 years ago when i had once gone passed it.
It was on 28th April 2007 when i stepped in and found around 100's alike lined up in a queue in front of HALL 9 all waiting to enroll themselves. We all were tensed not knowing what would happen in a place completely different to whatever most of us had been exposed so far.
I was lucky to have Partho Debnath as my first friend there and my roommate. I still remember how in the first week there both of us would explore most of the rooms of Hall 9 trying to make friends and learn about them . It was a great feeling that people throughout India were under a roof. Then perhaps the most dreaded moments came when boys visited each others rooms to know which zone he belonged. (you know why?) We had friendly interactions with our seniors who embraced us into their college families and thus our journey started.
Time flew past and soon we were sophomores. I was again greatful to have Navin Kumar Verma,a.k.a Navin ji as my roommate who inspired me greatly to believe that All is well :). I also met Anand Verma[a.k.a baba] , who till date gets up at 6 in morning , does some excercises, freshens up and then only studies and yes who also goes off to sleep by 11 at night.
Tests, assignments, proxies and bunking classes summed up the next years and we were sophomores no more.
Third year came and with it the tension to get a good internship . Sab lag gaye daud mein (including me). Inbox of IIT professors were flooded and many industries too gave us
opportunities. I too did my project on Android platform which was quiet satisfying.
Well third year too passed by as we now entered into the final lap.
We were now the BTech seniormost and that gave a completely different though not new feeling. Soon campussing started and most of us got placed at good places. Soon it was my chance and i too got placed. :) At first it felt that now what? But then i realised that Mukit'11 was coming up and we had to make it large. It was a grand success with participants all over the world (we had some online events too.) Mukti ended , now what, two months passed by and entered April and it was project time. I would be highly greatful to Howlader Sir who helped a lot in my Cryptography project. What a guide!
Soon exams were knocking and though we had only a couple of papers and we knew it would end before we would realise it. So finally it ended within a span of 5 days and now i sit before my computer writing this and realising that yes this is it. Well one phase of my journey has ended but there are many a miles to walk before i stop. Its been a great golden period of my life, emboidered by moments like India winning the World cup. Oh! that tumbling in mud in Hall 9 to running on streets in the final year. These moments would be treasured for ever.
Lets see next is what?