| Algorithm 2: Updating-Token |
| Input: A token and its readings sorted in descending order |
| Output: An updated token |
| 1) for i=1 to the number of the readings in the token |
| 2) scan the readings in order |
| 3) if (the local reading > the i-th reading in the token) |
| 4) insert the local reading before the i-th reading |
| 5) break |
| 6) end if |
| 7) end for |
| 8) if the number of readings in the token beyond k |
| 9) delete the last reading in the token |
| 10) end if |