Hello,everyone!

I have been suffer from a problem as tile says.

I have no idea to solve this problem.

I hope anyone who can help me! Thanks.

The following is the question:

In this project, you are going to invent a minimal seek-distance disk scheduler under a given QOS constraint t. We can formulate this problem into a one-to-one mapping problem as follows. Assume that the total number of disk references is N. There are two sequences, the requested sequence, `{A1, A2, …, AN}`

, and the scheduled sequence, `{R1, R2, …, RN}`

. In the requested sequence, the i-th element Ai represents the disk address of the i-th requested access. In the scheduled sequence, the j-th element Rj represents that the j-th scheduled access is the Rj-th requested access in the requested sequence. According to the definition of Rj as well as the given QOS constraint t,both `1≤Rj≤N`

and `j-t≤Rj≤j+t`

must be satisfied for all `1≤j≤N`

. The objective function of the minimal seek-distance disk scheduler is:

```
min{Σ(ARj -AR(j-1)},for j=1,to j=N;
R0=0,AR0=A0=0;
```

There are two inputs in your program, the requested sequence (ex: "access.in") and the QOS constraint t. There are also two outputs in your program, the scheduled sequence ("access.out") and the total seek-distance.

Can anyone help me? Thanks.

If you can not find the min distance,you can find the next min distance.

Not always the min distance.