Basic and Advance C Question:
Download Job Interview Questions and Answers PDF
How can I sort more data than will fit in memory?
Answer:
You want an ``external sort,'' which you can read about in Knuth, Volume 3. The basic idea is to sort the data in chunks (as much as will fit in memory at one time), write each sorted chunk to a temporary file, and then merge the files. Your operating system may provide a general-purpose sort utility, and if so, you can try invoking it from within your program:
Download C Programming Interview Questions And Answers
PDF
Previous Question | Next Question |
Did C have any Year 2000 problems? | How can I sort a linked list? |