• edited by
2,923 views
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

1 Answer

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/

Position:
Show:

Related questions

1 1 vote
0 0 answers
1.6k
1.6k views
shraddha priya asked May 18, 2019
1,584 views
Why does OS and DBMS have their own synchronisation mechanisms, when OS can alone do it and it sits at the bottom of DB?
1 1 vote
2 2 answers
4.8k
4.8k views
Abhinav_Kumar_singh asked Feb 2, 2025
4,848 views
The IIIT Hyderabad PGEE syllabus does not mention Compiler Design, Theory of Computation (TOC), or Computer Organization & Architecture (COA). Should I still study these ...
1 1 vote
0 0 answers
905
905 views
adam121026 asked May 28, 2024
905 views
So, I got an offer of Mtech in CSIS, which was my second preference, wanted advice on whether to not lock and wait cse further rounds or should I lock the option ffor CSI...
1 1 vote
1 1 answer
8.0k
8.0k views
vyarth asked Apr 28, 2022
7,971 views
I know they don't release these data but what is the estimated number of candidates according to previous data?