You have a computer with only 2Mb of main memory. How do you use it to sort a large file of 500 Mb that is on that disk?

This was a question that I was asked.... but I couldn't figure out the answer.
Please help !!!!

Sort in chunks, then merge.

Something on the lines of

Subset the data set into multiple smaller data sets that have a manageable sort size for your system.
Then perform your sort algorithms on these's smaller data sets & then merge sorted data sets.

Finally chuck that old pc into the canal, buy a decent spec machine so you can install MYSQL and make use of SQL

Sorted.

How does MySQL sort a text file, and why would someone use it for this type of sort?

And what makes you think this is a real problem? Isn't it more likely a hypothetical question to teach a student how to solve a problem?

Sort in chunks, then merge.

Okay......!!
U mean Merge Sort !!!
Thanx....

WaltP

]And what makes you think this is a real problem? Isn't it more likely a hypothetical question to teach a student how to solve a problem

?

I know this was not a real problem, I knew the nature of the question as you rightly pointed out for the student be able to understand problem solving.

How does MySQL sort a text file, and why would someone use it for this type of sort?

Again your right with regards to MYSQL sorting txt files. MySQL is a relational database management system (RDBMS) "for the benefit of the OP", but it nice to have a laugh once in a while & as for the "type of sort" that's a matter of personal opinion.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.