Given a file (can be a huge file) , write the code to extract the last 'n' lines of the file.
what kind of logic efficient here...?? I mean is it like going at the end of file and then reading from there until we find n number of newline characters. or we can have two pointers 1st pointing at the n'th line from starting and the second ptr pointing at starting. and then moving each pointer one line by one line. when the fast pointer reaches at the EOF. Then start reading all the lines from the slow pointers until EOF is reached. Is there any other efficient way of doing it. Please answer with proper implementation details Thanks. deadlock --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---
