Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:虽然AC了不过还是想请教输入. 数据输入的时候为了转化成树,怎么做才快呢?我的方法是做循环链表,读取第1组数据,然后后面的数据如果有前面的关键字那么读取,然后删去,若未读则跳过.感觉这样好慢..

Posted by Shinjikun at 2007-06-15 18:06:05 on Problem 3140
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator