| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:虽然AC了不过还是想请教输入. 数据输入的时候为了转化成树,怎么做才快呢?我的方法是做循环链表,读取第1组数据,然后后面的数据如果有前面的关键字那么读取,然后删去,若未读则跳过.感觉这样好慢..In Reply To:Re:虽然AC了不过还是想请教输入. 数据输入的时候为了转化成树,怎么做才快呢?我的方法是做循环链表,读取第1组数据,然后后面的数据如果有前面的关键字那么读取,然后删去,若未读则跳过.感觉这样好慢.. Posted by:FOR_RITZ at 2007-01-30 23:05:43 > 计算的时间开销为O(N),输入的开销却可能高达为O(N^2)...
struct Node;
struct Edge
{
Node* node;
Edge* next;
};
struct Node
{
unsigned int load;
Edge *edgelist;
}nodes[...];
边就加在edgelist的表头
时间是O(n)
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator