write your own tests to check the correctness of your implementation.

Introduction

In terms of concept, it’s a simple assignment where a runner is keeping track of their running activities. Each run is characterized by two attributes: distance (in kms) and time (in seconds). Each instance of a Run object also holds references to two other Run objects:

  1. prev: Run (if any) before the instance.
  2. next: Run (if any) after the instance.

Thus, we can track runs from earliest to latest using next, or latest to earliest using prev.

Your task

Your task is to complete the nine methods in the class Run.java.

IMPORTANT: All methods except addToFront require correct implementation of addToEnd as a pre-requisite.

For some methods, such as addToEndaddToFrontsize(), etc., it doesn’t matter which object in the list the methods is called on, the result should be the same.

For example, if there is a list of 20 runs starting at r, each of the following should return 20:

  1. r.size()
  2. r.next.next.next.size()
  3. r.next.next.next.next.next.prev.prev.size()

Helper methods and variables

You can, and if using recursion, will need to, add helper methods. You can add instance variables and class (static) variables as well.

Help document

A document to help you with the concept of the need to traverse to the first node, and for a helper method (for a good chunk of the methods) is provided in a4help.pdf at the bottom of the page.

Advanced tasks

Tests for the following methods are NOT supplied:

  1. add(Run) (10 marks)
  2. longestSequenceOver(double) (15 marks)
  3. getRunsOver(double) (15 marks)

You need to write your own tests to check the correctness of your implementation.

Grading criteria

Maximum marks for each method are provided in the tests corresponding to the methods. For full marks, you need to solve this assignment purely recursively. So, if you use a loop, even once, in any method, your marks will be reduced by 30% automatically. We hope the following table makes the situation clear for you.

Number of times loops used Raw Mark Final Mark
0 80 80
1 90 63
10 90 63
1 100 70

If it doesn’t, the following flowchart might help:

Submission format

Drag the file Run.java into the submission box. You got this!

Importing libraries

You cannot use any external library. The use of ANY function from outside the Run class will result in an automatic zero

find the cost of your paper

Assess why it has proven so difficult to design an operating procedure which allows the European Court to effectively manage its case load.

‘The results so far achieved within the framework of Protocol No. 14 are encouraging, particularly as a result of the measures taken by the Court to increase efficiency and address….

Evaluate whether the operation of human rights under the ECHR really does force public authorities to ‘act in ways that fly in the face of common sense’?

‘[I]n this country we are proud to stand up for human rights, at home and abroad. It is part of the British tradition. But what is alien to our tradition….