1 1 vote You have 1 billions elements, but memory which can hold only 1 million. How would you sort it using merge sort? Source-:https://gateoverflow.in/blog/4532/iiit-hyderabad-interview-experience-2017 Algorithms interview mtech iiith-pgee merge-sort + – Aakanchha 2.9k views answer comment Share Follow Print See all 2 Comments 2 2 Comments reply Aakanchha commented May 17, 2018 reply Follow flag is external sorting the answer for this? i.e dividing the input into chunks and sorting them individually and the merging the sorted chunks using merge procedure in the input source. 0 0 replyShare pankaj_vir commented May 17, 2018 reply Follow flag Yes, we need to do the external sorting. 0 0 replyShare Please log in or register to add a comment.
1 1 vote We first divide the file into runs such that the size of a run is small enough to fit into main memory. Then sort each run in main memory using merge sort sorting algorithm. Finally merge the resulting runs together into successively bigger runs, until the file is sorted. Source: https://www.geeksforgeeks.org/external-sorting/ Nirmal Gaur answered Apr 8, 2019 Nirmal Gaur comment Share Follow 0 reply Please log in or register to add a comment.