INPUT: Floor is 3
INPUT: Initial element 0 is 3
INPUT: Initial element 1 is 4
INPUT: Initial element 2 is 25
INPUT: Initial element 3 is 6
INPUT: Initial element 4 is 10
INPUT: Compiled to show input.
OUTPUT: Compiled to show output.
ALGORITHM: Compiled to show algorithm.
INPUT: Change in cycle 1 to element 0 is 0
INPUT: Change in cycle 1 to element 1 is 2
INPUT: Change in cycle 1 to element 2 is 0
INPUT: Change in cycle 1 to element 3 is 1
INPUT: Change in cycle 1 to element 4 is 0
OUTPUT: After user changes, element 0 is 3
OUTPUT: After user changes, element 1 is 6
OUTPUT: After user changes, element 2 is 25
OUTPUT: After user changes, element 3 is 7
OUTPUT: After user changes, element 4 is 10
ALGORITHM: Full cycle is 48
ALGORITHM: Total periods before balancing is 51
ALGORITHM: Distributing change -3
ALGORITHM: Offset for integer operations is -1
ALGORITHM: Period 0 is 3
ALGORITHM: period - offset is 4
ALGORITHM: change * (period - offset) is -12
OUTPUT: After first phase of rebalancing, element 0 is 3; change of 0 compared to average of 0
ALGORITHM: Period 1 is 6
ALGORITHM: period - offset is 7
ALGORITHM: change * (period - offset) is -21
OUTPUT: After first phase of rebalancing, element 1 is 6; change of 0 compared to average of 0
ALGORITHM: Period 2 is 25
ALGORITHM: period - offset is 26
ALGORITHM: change * (period - offset) is -78
OUTPUT: After first phase of rebalancing, element 2 is 24; change of -1 compared to average of 0
ALGORITHM: Period 3 is 7
ALGORITHM: period - offset is 8
ALGORITHM: change * (period - offset) is -24
OUTPUT: After first phase of rebalancing, element 3 is 7; change of 0 compared to average of 0
ALGORITHM: Period 4 is 10
ALGORITHM: period - offset is 11
ALGORITHM: change * (period - offset) is -33
OUTPUT: After first phase of rebalancing, element 4 is 10; change of 0 compared to average of 0
ALGORITHM: Total periods after balancing is 50
ALGORITHM: Balancing left over -2 units from -3
ALGORITHM: Decrementing period 2.
ALGORITHM: Decrementing period 4.
OUTPUT: After second phase of rebalancing, element 0 is 3; change of 0 compared to previous 3
OUTPUT: Period 0 ends cycle 1 at 3
OUTPUT: After second phase of rebalancing, element 1 is 6; change of 0 compared to previous 6
OUTPUT: Period 1 ends cycle 1 at 6
OUTPUT: After second phase of rebalancing, element 2 is 23; change of -1 compared to previous 24
OUTPUT: Period 2 ends cycle 1 at 23
OUTPUT: After second phase of rebalancing, element 3 is 7; change of 0 compared to previous 7
OUTPUT: Period 3 ends cycle 1 at 7
OUTPUT: After second phase of rebalancing, element 4 is 9; change of -1 compared to previous 10
OUTPUT: Period 4 ends cycle 1 at 9
INPUT: Change in cycle 2 to element 0 is 2
INPUT: Change in cycle 2 to element 1 is 1
INPUT: Change in cycle 2 to element 2 is 3
INPUT: Change in cycle 2 to element 3 is 1
INPUT: Change in cycle 2 to element 4 is -1
OUTPUT: After user changes, element 0 is 5
OUTPUT: After user changes, element 1 is 7
OUTPUT: After user changes, element 2 is 26
OUTPUT: After user changes, element 3 is 8
OUTPUT: After user changes, element 4 is 8
ALGORITHM: Full cycle is 48
ALGORITHM: Total periods before balancing is 54
ALGORITHM: Distributing change -6
ALGORITHM: Offset for integer operations is -3
ALGORITHM: Period 0 is 5
ALGORITHM: period - offset is 8
ALGORITHM: change * (period - offset) is -48
OUTPUT: After first phase of rebalancing, element 0 is 5; change of 0 compared to average of -1
ALGORITHM: Period 1 is 7
ALGORITHM: period - offset is 10
ALGORITHM: change * (period - offset) is -60
OUTPUT: After first phase of rebalancing, element 1 is 7; change of 0 compared to average of -1
ALGORITHM: Period 2 is 26
ALGORITHM: period - offset is 29
ALGORITHM: change * (period - offset) is -174
OUTPUT: After first phase of rebalancing, element 2 is 24; change of -2 compared to average of -1
ALGORITHM: Period 3 is 8
ALGORITHM: period - offset is 11
ALGORITHM: change * (period - offset) is -66
OUTPUT: After first phase of rebalancing, element 3 is 8; change of 0 compared to average of -1
ALGORITHM: Period 4 is 8
ALGORITHM: period - offset is 11
ALGORITHM: change * (period - offset) is -66
OUTPUT: After first phase of rebalancing, element 4 is 8; change of 0 compared to average of -1
ALGORITHM: Total periods after balancing is 52
ALGORITHM: Balancing left over -4 units from -6
ALGORITHM: Decrementing period 2.
ALGORITHM: Decrementing period 4.
ALGORITHM: Decrementing period 3.
ALGORITHM: Decrementing period 1.
OUTPUT: After second phase of rebalancing, element 0 is 5; change of 0 compared to previous 5
OUTPUT: Period 0 ends cycle 2 at 5
OUTPUT: After second phase of rebalancing, element 1 is 6; change of -1 compared to previous 7
OUTPUT: Period 1 ends cycle 2 at 6
OUTPUT: After second phase of rebalancing, element 2 is 23; change of -1 compared to previous 24
OUTPUT: Period 2 ends cycle 2 at 23
OUTPUT: After second phase of rebalancing, element 3 is 7; change of -1 compared to previous 8
OUTPUT: Period 3 ends cycle 2 at 7
OUTPUT: After second phase of rebalancing, element 4 is 7; change of -1 compared to previous 8
OUTPUT: Period 4 ends cycle 2 at 7
INPUT: Change in cycle 3 to element 0 is 0
INPUT: Change in cycle 3 to element 1 is 1
INPUT: Change in cycle 3 to element 2 is 4
INPUT: Change in cycle 3 to element 3 is 0
INPUT: Change in cycle 3 to element 4 is 0
OUTPUT: After user changes, element 0 is 5
OUTPUT: After user changes, element 1 is 7
OUTPUT: After user changes, element 2 is 27
OUTPUT: After user changes, element 3 is 7
OUTPUT: After user changes, element 4 is 7
ALGORITHM: Full cycle is 48
ALGORITHM: Total periods before balancing is 53
ALGORITHM: Distributing change -5
ALGORITHM: Offset for integer operations is -2
ALGORITHM: Period 0 is 5
ALGORITHM: period - offset is 7
ALGORITHM: change * (period - offset) is -35
OUTPUT: After first phase of rebalancing, element 0 is 5; change of 0 compared to average of -1
ALGORITHM: Period 1 is 7
ALGORITHM: period - offset is 9
ALGORITHM: change * (period - offset) is -45
OUTPUT: After first phase of rebalancing, element 1 is 7; change of 0 compared to average of -1
ALGORITHM: Period 2 is 27
ALGORITHM: period - offset is 29
ALGORITHM: change * (period - offset) is -145
OUTPUT: After first phase of rebalancing, element 2 is 25; change of -2 compared to average of -1
ALGORITHM: Period 3 is 7
ALGORITHM: period - offset is 9
ALGORITHM: change * (period - offset) is -45
OUTPUT: After first phase of rebalancing, element 3 is 7; change of 0 compared to average of -1
ALGORITHM: Period 4 is 7
ALGORITHM: period - offset is 9
ALGORITHM: change * (period - offset) is -45
OUTPUT: After first phase of rebalancing, element 4 is 7; change of 0 compared to average of -1
ALGORITHM: Total periods after balancing is 51
ALGORITHM: Balancing left over -3 units from -5
ALGORITHM: Decrementing period 2.
ALGORITHM: Decrementing period 4.
ALGORITHM: Decrementing period 3.
OUTPUT: After second phase of rebalancing, element 0 is 5; change of 0 compared to previous 5
OUTPUT: Period 0 ends cycle 3 at 5
OUTPUT: After second phase of rebalancing, element 1 is 7; change of 0 compared to previous 7
OUTPUT: Period 1 ends cycle 3 at 7
OUTPUT: After second phase of rebalancing, element 2 is 24; change of -1 compared to previous 25
OUTPUT: Period 2 ends cycle 3 at 24
OUTPUT: After second phase of rebalancing, element 3 is 6; change of -1 compared to previous 7
OUTPUT: Period 3 ends cycle 3 at 6
OUTPUT: After second phase of rebalancing, element 4 is 6; change of -1 compared to previous 7
OUTPUT: Period 4 ends cycle 3 at 6
INPUT: Change in cycle 4 to element 0 is 0
INPUT: Change in cycle 4 to element 1 is 7
INPUT: Change in cycle 4 to element 2 is 0
INPUT: Change in cycle 4 to element 3 is 0
INPUT: Change in cycle 4 to element 4 is 0
OUTPUT: After user changes, element 0 is 5
OUTPUT: After user changes, element 1 is 14
OUTPUT: After user changes, element 2 is 24
OUTPUT: After user changes, element 3 is 6
OUTPUT: After user changes, element 4 is 6
ALGORITHM: Full cycle is 48
ALGORITHM: Total periods before balancing is 55
ALGORITHM: Distributing change -7
ALGORITHM: Offset for integer operations is -3
ALGORITHM: Period 0 is 5
ALGORITHM: period - offset is 8
ALGORITHM: change * (period - offset) is -56
OUTPUT: After first phase of rebalancing, element 0 is 5; change of 0 compared to average of -1
ALGORITHM: Period 1 is 14
ALGORITHM: period - offset is 17
ALGORITHM: change * (period - offset) is -119
OUTPUT: After first phase of rebalancing, element 1 is 13; change of -1 compared to average of -1
ALGORITHM: Period 2 is 24
ALGORITHM: period - offset is 27
ALGORITHM: change * (period - offset) is -189
OUTPUT: After first phase of rebalancing, element 2 is 21; change of -3 compared to average of -1
ALGORITHM: Period 3 is 6
ALGORITHM: period - offset is 9
ALGORITHM: change * (period - offset) is -63
OUTPUT: After first phase of rebalancing, element 3 is 6; change of 0 compared to average of -1
ALGORITHM: Period 4 is 6
ALGORITHM: period - offset is 9
ALGORITHM: change * (period - offset) is -63
OUTPUT: After first phase of rebalancing, element 4 is 6; change of 0 compared to average of -1
ALGORITHM: Total periods after balancing is 51
ALGORITHM: Balancing left over -3 units from -7
ALGORITHM: Decrementing period 2.
ALGORITHM: Decrementing period 1.
ALGORITHM: Decrementing period 4.
OUTPUT: After second phase of rebalancing, element 0 is 5; change of 0 compared to previous 5
OUTPUT: Period 0 ends cycle 4 at 5
OUTPUT: After second phase of rebalancing, element 1 is 12; change of -1 compared to previous 13
OUTPUT: Period 1 ends cycle 4 at 12
OUTPUT: After second phase of rebalancing, element 2 is 20; change of -1 compared to previous 21
OUTPUT: Period 2 ends cycle 4 at 20
OUTPUT: After second phase of rebalancing, element 3 is 6; change of 0 compared to previous 6
OUTPUT: Period 3 ends cycle 4 at 6
OUTPUT: After second phase of rebalancing, element 4 is 5; change of -1 compared to previous 6
OUTPUT: Period 4 ends cycle 4 at 5