Language Comparison

Overview

In this assignment, you will implement the same program in two different programming languages: OCaml and a language of your choice. Both implementations must:

Problem Specification

Your program reads a list of dependent tasks and must produce either:

This is a deterministic, well‑specified problem.

Input Format

This input is called the task list.

Task Name Rules

Two tasks with the same name are considered the same task (string equality).

Example

Input

learn OCaml
read the OCaml documentation
do the programming assignment
learn OCaml

Interpretation

Output

read the OCaml documentation
learn OCaml
do the programming assignment

Cycles

If the task list contains any cycle, regardless of size or whether other parts are acyclic, your program must output: cycle

Example Cyclic Input

A
B
B
C
C
A

A depends on B, B depends on C, but C depends on A.

Output Rules

Invalid Inputs

Duplicate task pairs (same dependency appearing twice) are invalid. The program behavior for such inputs is undefined. You will not be tested on invalid inputs

Choosing Among Unconstrained Tasks

If multiple tasks have no remaining dependencies, you must choose which to output next using ascending ASCII alphabetical order. This guarantees a unique, deterministic output for every valid input.

Example

B
A
B
C
D
B

Correct output:

A
C
B
D

Here, both A and C are initially unconstrained; since A < C, the former is chosen first.

More Complex Example

Task list:

B
A
C
D
C
E

Correct output:

A B D E C

Note that B comes before D and E, even though B depends on A. This is because, once A is finished, B is free to go and it comes first alphabetically. A D E B C is incorrect and will receive no credit.

Submission

Submit a single ZIP file named project6-handin containing:

Required

README Content

Write several paragraphs addressing:

Grammar, spelling, and clarity matter.

Grading Rubric (25 points total)