b********e 发帖数: 693 | 1 Most frequent path of 3 websites.
Given a log file, which contains a series of websites, which the user has vi
sited, find the most frequent path of 3 websites.
e.g: If this is a log file
A B C D E
A C D B E
C D E B A
A C D E B
C D E A B
Clearly, C D E in the most frequent website?
First I said graph, then I said hash table. Hash every 3 consecutive web sit
es and increment in Hash Table. Parse through HT and keep a variable which s
tores the max value you get the answer. | r**u 发帖数: 1567 | 2 CDE必须连续么?
vi
【在 b********e 的大作中提到】 : Most frequent path of 3 websites. : Given a log file, which contains a series of websites, which the user has vi : sited, find the most frequent path of 3 websites. : e.g: If this is a log file : A B C D E : A C D B E : C D E B A : A C D E B : C D E A B : Clearly, C D E in the most frequent website?
|
|