Question: Haskell Language In a comparison network, comparisons (x, y) and (a, b) may be done in parallel when the set {x, y} is disjoint from
Haskell Language
In a comparison network, comparisons (x, y) and (a, b) may be done in parallel when the set {x, y} is disjoint from {a, b}. In that case, the two comparisons are working on separate pairs of wires, so they could execute simultaneously. We can represent a comparator network in parallel form as a list of lists. Each element list shows comparisons that can happen in parallel. For example, a parallel form for sort1.txt is the list of lists: [[(1,2),(3,4)],[(1,3),(2,4)],[(2,3)]] The command line for this part is Parallel filename Here, filename is again the name of a file containing a comparator network, like sort1.txt. Your code should write the parallel form to a file parallel.txt, in this format (for the above example): 1 -- 2 , 3 -- 4 1 -- 3 , 2 -- 4 2 -- 3 On each line, please order the comparators by first wire number. So it would not be legal to have 3 -- 4 , 1 -- 2 because the first wire number (3) of the first comparison is greater than the first wire number (1) of the second. Please use the same spacing as above so that your output can be easily compared with expected output.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
