views:

44

answers:

1

I am try to solve a prob in one of the Programming contests.The actual prob is sort a given list of numbers.I am using a algorithm with complexity(nlog n) and that is the maximum level of optimization I can do with the algorithm.Now from the forum I understood that I need a faster I/O for which I should create a new reader class.I/O are from and to the standard I/O.

I want to know how to create a reader class (insted of other standard Reader classes)?

Thanks in Advance!

+1  A: 

This question really seems like a "barking up the wrong tree" kind of question. I find it unlikely that you'd be able to subclass Reader and make it run faster, given that you don't know how to do it. If there was an obvious way, wouldn't it already be in java?

If I/O speed is the problem, perhaps it's the method you're using. There are several different types of Readers, and several algorithms to use them. For example, do you read the whole file at once then parse it, or do you read one line at a time? Some of these options may not even be possible depending on the type of file, size of the file, and other conditions.

If you're trying to solve a problem for a programming contest, solving the actual problem should be all that's required. You shouldn't have to create your own Reader class unless that's a part of the problem being described. Besides, you mention that you're getting your direction from a forum. How do you know they even know what they're talking about?

So, I feel like you're doing something wrong here that's outside the scope of the question you asked.

Erick Robertson