Homework 5

Due: See class webpage

- Implements Greenwald's ε-quantile approximation algorithm
to find the φ-quantile in a stream, for an arbitrary φ.
- Relevant lecture notes:
click here
- You should implement the algorithm
given
**at the end**of the lecture notes click hereThis version

**does not**use bands...

- You should implement the algorithm
given
- Programming required in this assignment:
- Command line to invoke program:
- Make sure the capitalization of the command "Greenwald" is exactly as given above.

Greenwald ε < InputFile or: jave Greenwald ε < InputFile

- Meaning of the input arguments:
- InputFile = input data file.
I will provide a test data file later in this handout. The data file will have the following format:

v1 (data point 1) v2 (data point 2) v3 (data point 3) ...... vN (data point N)

- ε = the precision parameter in Greenwald's algorithm

- InputFile = input data file.
- Output that you need to generate:
- At each deletion point
in Greenwald's algorithm, print out the content of the
data structure as:

and as:**S: (e**_{1}, g_{1}, Δ_{1}) (e_{2}, g_{2}, Δ_{2}) ...**S: e**_{1}[r_{min}(e_{1})..[r_{max}(e_{1})], e_{2}[r_{min}(e_{2})..[r_{max}(e_{2})] ...before the space reduction step.

- Then
**perform the space reduction step**and - Print the
**new content**of the data structure again. (You can learn a lot from this output). - Then print the
**answer**for these**quantile queries**:-
Find the element at rank

**3n**- for**3n ≤ N**

- At each deletion point
in Greenwald's algorithm, print out the content of the
data structure as:
- At the end of the algorithm, print:
- The content of the data structure at the end of the algorithm
as:

and as:**S: (e**_{1}, g_{1}, Δ_{1}) (e_{2}, g_{2}, Δ_{2}) ...**S: e**_{1}[r_{min}(e_{1})..[r_{max}(e_{1})], e_{2}[r_{min}(e_{2})..[r_{max}(e_{2})] ... - Print the following list:
- Print
**εN**once... - The ranking index (1, 2, ..., N)
- the
**actual item**at the rank position (store the items from the input in an array and**sort it**!) - the item that Greenwald's algorithm will output when given the ranking index,
- and the
**actual error**that the algorithm made (how many positions off)

The output format will look like this:

εN (the value of εN let us know what is max error is) rank Actual Answer Actual err of answer --------------------------------------------------------------- 1 v

_{1}G_{1}err_{1}2 v_{2}G_{2}err_{2}3 v_{3}G_{3}err_{3}.... N v_{N}G_{N}err_{N}How to compute the

**actual error**:- The correct answer for rank
**r**is**v**_{r}The

**provided answer**is**G**_{r} - Suppose the value
**G**is the value_{r}**v**_{s}The the

**actual error**is:**s − r**

- Print

- The content of the data structure at the end of the algorithm
as:

- Command line to invoke program:

- Test data file 1: click here
- Larger Test data file 2:
click here
- Try running it with
**ε=0.1**I don't have the answers, but I can tell you to make sure that the

**summary**always contains the**smallest value**and the**largest value**in the input.

- Turn in a Makefile using the command:
/home/cs584000/turnin Makefile hw5

(If you use Java, you still need a Makefile. Let me know if you don't know how to create a Makefile) - Turn in each header and program file using this command:
/home/cs584000/turnin Filename hw5-?

where "?" is a number from 0 to 9.