Design a table or a database:
1- Begin operation
2- Accept input of a real, positive number, D1
3- Register time of D1 receipt, T1
4- Assign D1 a unique record identifier, ID1
5- Compare D1 to a preset constant, A
6- Register the numeric difference between A and D1 (positive or negative), Call it C1
7- Create a record (row) for ID1, T1, D1, and C1, call this record n=1
8- Accept input of another real, positive number, D2
9- Register time of D2 receipt, T2
10- Assign a unique record identifier, ID2
11- Compare D2 to a preset constant, A
12- Register the numeric difference between A and D2 (positive or negative), Call it C2
13- Create a record (row) for ID2, T2, D3, and C3, call this record n=2
14- Create a field (column) for rank, R.
15- Sort table by Descending value of D’s,
16- In the rank field, R, number each row starting with 1, so that row1, R1, has the largest D value, row 2, R2, has the secong highest D value, and so on.
17- Create a field (column) for the cumulative sum of C’s (∑Cn , where n= 1 to n)
18- Accept next input, D3 and repeat above steps until:
19- Stop accepting input when
a. preset time, T, expires, or
b. when n› N (N preset constant integer) for all records where ∑Cn-1 ›Cn
20- Close operation.