频道栏目
首页 > 资讯 > 其他综合 > 正文

正向表模板

17-03-09        来源:[db:作者]  
收藏   我要投稿

正向表模板:正向表用于优化vector的速度。注意正向表是反序查询的。

/*_________________________正向表_______________________________*/
// !!!!!!!!!M=2*M;
//NO.one
int tot,h[M];//标号
struct node{
    int to;//val
    int nx;//must have it pointed the next one
}G[M<<1];
void Add(int a,int b){
    G[++tot].to=b;//val
    G[tot].nx=h[a];//h[]初值为0
    h[a]=tot;
}
for(register int i=h[x];i;i=G[i].nx) //如果为0终止


//NO.two
int A[M],B[M],C[M];//信息
int tot,h[M],nx[M];
void Add(int x,int a,int b,int c){
    //信息 
    A[++tot]=a;
    B[tot]=b;
    C[tot]=c;
    //连接 
    nx[tot]=h[x];
    h[x]=tot;

}
for(register int i=h[x];i;i=nx[i])
    a=A[i],b=B[i],c=C[i];
/*______________________________________________________________*/
相关TAG标签
上一篇:Apache Struts2 曝任意代码执行漏洞 (S2-045,CVE-2017-5638)
下一篇:关于Apache Struts2(S2-045)漏洞情况的通报
相关文章
图文推荐

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站