-
-
Notifications
You must be signed in to change notification settings - Fork 47.1k
Closed
Description
Objective
- Merge a set of sorted files of different length into a single sorted file. We need to find an optimal solution, where the resultant file will be generated in minimum time.
Approach
- If the number of sorted files are given, there are many ways to merge them into a single sorted file. This merge can be performed pair wise.
- To merge a
m-record
file and an-record
file requires possiblym+n
record moves, the optimal choice being, merge the two smallest files together at each step(greedy approach)
.
Hey, @poyea
I would like to contribute the mentioned algorithm to the repo.
Also if you feel its worth the contribution, please guide me as where to put this algo in the directory tree as there is no dedicated directory for greedy algorithms.
Waiting for your response...!
Metadata
Metadata
Assignees
Labels
No labels