2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by virendra_sharma
0
String[] lines = File.ReadAllLine("filename");
Array.Sort(lines);
File.WriteAllLines("filename", lines);

50 MB is nothing to a modern computer. In memory sorting will be faster than anything else. As a test I created a 54 MB file consisting of 1,470,588 strings. It took 1.729 seconds to read the file, 17.487 seconds to sort it and 0.690 seconds to write the file back to the disk.

0
String[] lines = File.ReadAllLine("filename");
Array.Sort(lines);
File.WriteAllLines("filename", lines);

50 MB is nothing to a modern computer. In memory sorting will be faster than anything else. As a test I created a 54 MB file consisting of 1,470,588 strings. It took 1.729 seconds to read the file, 17.487 seconds to sort it and 0.690 seconds to write the file back to the disk.

Hi can you plz , give me the code for to calculate the time it take for to read , write and for to sort and also i want to know which sorting algorithm is fastest e.g bubble sort, merger sort, quick sort, heap sort etc.

thanks buddy

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.