I'm interested in knowing whether it is advisable for computer science students to spend their major chunk of time on the online judges practising programming(like Topcoder and codeforces) or it's more worth to develop a software or contribute to open-source ?
As an employer my answer would be both.
The topcoder is like training in a martial art every week, you learn new bits, practice and improve.
The open-source software projects is like the competition where you try out the learnings and take the hits.
You can do either in isolation and be either techically great but no real world experience or able to dive in a hack away proficiently without knowing the ground rules, background and learning better ways.
The real answer is to get a very good understanding of the theory and put it into practice as many times and in as many situations as you can. The learning may come from books, lectures, sitting next to more senior developers, asking questions on sites like this, dreaming ideas and seeing if you can build them ... try them all, they will each give you a new perspective.
In my experience, open-source and software projects are worth much more in the eyes of recruiters than solving algorithm problems. Sure, algorithms etc are cool, fun and interesting, but they are only marginally involved in every-day software engineering in practice. Open-source projects are excellent for learning software engineering and quality programming.
To be blunt: I have yet to see any software project fail due to algorithmic difficulties, but I've seen plenty of projects fail due to poor software engineering, technical debt, bad architectures, bugs and poor design.