假設同樣的模式,我們有如下列表:查找列表
List<int> Journey1 = new List<int>() { 1, 2, 3, 4, 5 };
List<int> Journey2 = new List<int>() { 2, 3, 4, 6, 7, 3, 4 };
List<int> Journey3 = new List<int>() { 6, 7, 1 };
List<int> Journey4 = new List<int>() { 3, 1, 4 };
而且圖案:
2, 3, 4 -> Journey1, Journey2;
6, 7 -> Journey2, Journey3;
1 -> Journey2, Journey3, Journey4;
5 -> Journey1;
3, 4 -> Journey2;
3 -> Journey4;
4 -> Journey4;
我們有5000個列表,每個大約有200個項目,這樣的模式可以有介於1-200項之間,可在1-5000列表中查看。
因此我需要非常快速的模式匹配方式。
你能解釋規則嗎?例如。爲什麼它不是'3 - > Journey1,Journey2,Journey4' – Blorgbeard 2012-02-13 17:41:37
哦,模式是(序列)=>(要搜索的列表清單)? – Blorgbeard 2012-02-13 17:43:42
我們需要找到從最長到最短的圖案,因此我首先選擇2,3,4,這是在多次旅程中看到的最長的圖案。 – Behnam 2012-02-20 10:01:47