A printer can can plot points provided to it in the form of ‘x’ and

‘y’ coordinates. The plotter hand can move horizontally or vertically

only. Your program will be given a list of ‘n’ coordinates in the form

of {(x1,y1), (x2,y2} … (xn,yn)}. My program must print a sorted list

of all ‘n’ points that would represent the least cumulative distance

for the plotter hand to plot all ‘n’ points in that sorted order.

Also, can we modify the program to provide the same output if the

plotter can also move diagonally?

Let me know how would you approach this problem.