How to find N longest lines in a text file
<p>Write a program to read a multiple line text file and write the 'N' longest lines to stdout.</p>

<p>There was a similar question but I didn't really understand it since it involves using a min-heap and that would create more work since I'd have to create a min-heap data structure. </p>

<p>I tried to create an array that size n. Then sort it but I would have to sort it each and every time I inserted a new line into the array. I'd like to know what's the simple approach and what would be the optimal one.</p>
