Skip to main content
. 2021 Feb 4;21(4):1058. doi: 10.3390/s21041058
Algorithm 2 Update Group Tree
  • 1:

    functionUpdate(i,gpkj,typej,nodej)

  • 2:

        if typej=0, posj=i, otherwise posjprg({2,4,6,...,2n})

  • 3:

        nodej+1nodej, node[posj]j+1.sk$Zq*, node[posj]j+1.pknode[posj]j+1.sk·P

  • 4:

        return pos,UpdatePath(gpkj,nodej+1,posj)

  • 5:

    end function

  • 6:

    functionUpdatePath(gpkj,nodej,posj)

  • 7:

        curnode[pos]j+1,pathj[]

  • 8:

        while current node cur is not the root do

  • 9:

            the sk of cur’s parent is t(cur.sk·cur.sibling.pk), the pk of cur’s parent is its sk·P

  • 10:

            pathj.push(cur.pk), let cur move to the parent of cur

  • 11:

        end while

  • 12:

        return pathj,cur

  • 13:

    end function

  • 14:

    functionUpdateGpk(posj,gpkj,pathj,nodej)

  • 15:

        tmpnode[posj]

  • 16:

        while pathj[] do

  • 17:

            tmp.pkpathj.pop(), tmptmp.p

  • 18:

        end while

  • 19:

        return tmp

  • 20:

    end function