Create a command-line tool /app/topk that reads a large text file and outputs the k most frequent lines…
Create a command-line tool /app/topk that reads a large text file and outputs the k most frequent lines…: a task in TermGrade Environments: 1,004 executable Linux tasks (Harbor dataset). Input contract: - The tool receives exactly two arguments: k (integer ≥ 1) and input file (path to a UTF-8 text…
The task
**Input contract:** - The tool receives exactly two arguments: `k` (integer ≥ 1) and `input_file` (path to a UTF-8 text file). - Lines are delimited by `\n` (LF). The file may be very large (assume it does not fit in memory as a whole). - Lines may be empty (zero-length), contain only whitespace, contain…
Part of ai-and/termgrade-environments.