How to Sort a very large file | External Sorting technique

This video explains a very important interview question which is to sort a very large file which cannot fit in the main memory.We can only apply sorting algorithm to the data in main memory because accessing and doing operations on hard disk will be extremely slow.In this case, how do we sort optimally ? I have shown the intuitive solution to this problem which makes use of both main memory and hard disk to do optimized sorting using the external sorting technique.In this case, we divide the entire data into chunks of size available in main memory.Sort all the chunks and save them all in the hard disk.Now apply the technique of merging K sorted lists.This is how we can do external sorting for very large data size.

NOTES

Leave a Reply