邻接表+链式前向星

(我一个蒟蒻.分不清这两个姐妹qwq

这里写图片描述

邻接表:

1 -> 2 -> 3 -> 5
2 -> 3
3 -> 4
4 -> 1 -> 5
5 ->^

 

链式前向星:

edge[0].to = 2;     edge[0].next = -1;     head[1] = 0;

edge[1].to = 3;     edge[1].next = -1;     head[2] = 1;

edge[2].to = 4;     edge[2],next = -1;     head[3] = 2;

edge[3].to = 3;     edge[3].next = 0;      head[1] = 3;

edge[4].to = 1;     edge[4].next = -1;      head[4] = 4;

edge[5].to = 5;    edge[5].next = 3;       head[1] = 5;

edge[6].to = 5;     edge[6].next = 4;       head[4] = 6;

 

盗图怪是我了

posted @ 2019-04-28 20:01  darrrr  阅读(203)  评论(0编辑  收藏  举报