-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
48 lines (42 loc) · 1.42 KB
/
Program.cs
File metadata and controls
48 lines (42 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SuffixArray
{
class Program
{
static void Main(string[] args)
{
try
{
//SuffixList("mississippi");
//Naive.StringTest("banana", 1000001, 1, false);
//Skew.StringTest("banana", 1000001, 1, false);
var test = RandomString(4, 100);
Naive.StringTest(test, 1000001, 1, false);
Skew.StringTest(test, 1000001, 1, false);
//Skew.FileTest("E.coli", 21, 1, true);
//Skew.FileTest("shakespeare.txt", 21, 1, true);
}
catch (Exception e)
{
Console.WriteLine("Um erro ocorreu durante a execução do programa. Detalhes do erro:");
Console.WriteLine(e.StackTrace + e.Message);
}
Console.ReadKey();
}
static string RandomString(int chars, int size)
{
var alphabet = "abcdefghijklmnopqrstuvwxyz";
var random = new Random();
var result = new string(
Enumerable.Repeat(alphabet.Substring(alphabet.Length - chars, chars), size)
.Select(s => s[random.Next(s.Length)])
.ToArray());
return result;
}
}
}