Tuesday, June 16, 2009

Java v_s CPP v_s C in handling fast input data

for the last few months i have been using java for day2day programming and though it provides enough abstraction to handle common problems.

Recently i had a chance to implement Counting sort to achieve O(n) running time for large input.
First i implemented it in Java but it never fulfilled the time constraints of 5 seconds for input of size 10^6. reason was no efficient functionality in standard Java API for handling input through console efficiently.
so i use cpp using cin : count. even cpp can't fulfilled the 5 seconds time constraints. then i used old style scanf : printf functions of standard c library. then it works perfectly.

for more info visit problem statement and my submittion

No comments: