Data structures and Algorithm analysis question
I'm looking for an answer to this question that comes from a class on data structures and algorithms. I learned about the merge sort but don't remember clusters and buffers. I'm not quite sure I underst开发者_开发技巧and the question. Can someone help explain or answer it?
A file of size 1 Million clusters is to be sorted using 128 input buffers of one cluster size. There is an output buffer of one cluster size. How many Disk I/O's will be needed if the balanced k-way merge sort (a multi-step merge) algorithm is used?
It is asking about the total number of disk operations, a cluster here can be any size.
You need to know how many Disk IOs are needed per iteration of a balanced k-way merge sort. (hint: every merge pass requires reading and writing every value in the array from and to disk once)
Then you work out how many iterations must be performed to read your data.
The total number of Disk IOs can then be calculated.
精彩评论