Skip to main content
. 2017 Jun 14;17(6):1382. doi: 10.3390/s17061382
Algorithm 2 Class engagement analysis (CEA) algorithm.
Input: A new LCC message id,desc,time,loc, hash table HT, location q, time length T, small positive number ε.
Output: Hash table HT with the engagement ratio r.
 if id is not a key in HT then
  if loc∈q AND desc = LAS then
   TLAS←T; TLIS←ε;
  else if loc∈q AND desc = LIS then
   TLAS←0; TLIS←T;
  r←TLASTLIS;
  Insert a new key-value pair (id, [q,r,TLIS]) into HT;
 else if id is an existing key in HT then
  Get the value [q,r,TLIS] from HT using id;
  if loc∈q AND desc=LAS then
   r←r∗TLIS+TTLIS;
  else if loc∈q AND desc=LIS then
   r←r∗TLISTLIS+T; TLIS←TLIS+T
  Update the latest key-value pair (id, [q,r,TLIS]) into HT;