| Algorithm 2. Peak update (, , ) |
| If == |
| If =1 && ( − < ) && |
| Return(update-peak) |
| Elseif = −1 && ( − < ) && |
| Return(update-valley) |
| Else |
| Return(no-update) |
| Algorithm 2. Peak update (, , ) |
| If == |
| If =1 && ( − < ) && |
| Return(update-peak) |
| Elseif = −1 && ( − < ) && |
| Return(update-valley) |
| Else |
| Return(no-update) |