Class Chain

Cancelled Posted Jun 1, 2004 Paid on delivery
Cancelled Paid on delivery

Make a class `ChainWithReportSequences` which extends the class `Chain`. Write a method `reportSequences()` that has the following behavior:

* Count the number of non-decreasing sequences in the list .

* Return a new `Chain` that contains nodes with elements *e*??"*e**n*-1.

* *e* contains the number of sequences found.

* *e*1??"*e**n*-1 contain the indices for the heads of each sequence after the first. (**Notice:** We do not need to store the index for the head of the first sequence since it will always start at index 0.)

For example, the list *L* = (2, 3, 6, 1, 4, 5, 3, 9, 10, 12, 15) contains sequences (2, 3, 6), (1, 4, 5), and (3, 9, 10, 12, 15). Invoking `reportSequences()` on list *L* would return (3, 3, 6).

Write a method `printReport()` that gives formatted output based on the method `reportSequences()`. This means that `printReport()` **must** call `reportSequences()`.

For the list *L* = (4, 2, 2, 3, 5, 1, 1, 2, 3, 2), the formatted output is as follows:

`There are 4 non-decreasing sequences in the list:<br />

<br />

Sequence 1: (4)<br />

Sequence 2: (2, 2, 3, 5)<br />

Sequence 3: (1, 1, 2, 3)<br />

Sequence 4: (2)`

The template for the class is given below:

`package dataStructures;<br />

<br />

public class ChainWithReportSequences extends Chain {<br />

<br />

// data members (if necessary) go here<br />

// constructors go here<br />

<br />

public Chain reportSequences() {<br />

// your code goes here<br />

}<br />

<br />

public void printReport() {<br />

// your code goes here<br />

}<br />

<br />

// helper methods(if necessary) go here<br />

}`

You are not allowed to call any method in the `Chain` class.

1. (12) Write the code for the method `reportSequences()`.

2. (8) Write the code for the method `printReport()`.

3. (5) What is the time and space complexity of `reportSequences()`? Be as precise as possible.

## Deliverables

1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.

2) Deliverables must be in ready-to-run condition, as follows (depending on the nature of the deliverables):

a) For web sites or other server-side deliverables intended to only ever exist in one place in the Buyer's environment--Deliverables must be installed by the Seller in ready-to-run condition in the Buyer's environment.

b) For all others including desktop software or software the buyer intends to distribute: A software installation package that will install the software in ready-to-run condition on the platform(s) specified in this bid request.

3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement).

## Platform

Java running enviroment under windows.

Odd Jobs

Project ID: #3232245

About the project

Remote project Active May 22, 2009