-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
41 lines (34 loc) · 1.04 KB
/
Program.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ArboriPrefixati.PrefixTree;
namespace ArboriPrefixati
{
class Program
{
static void Main(string[] args)
{
Tree prefixTree = new Tree();
prefixTree.AddWord("abc");
prefixTree.AddWord("abcd");
prefixTree.AddWord("abcde");
prefixTree.AddWord("abcdef");
prefixTree.AddWord("ab123cd");
prefixTree.AddWord("abc123d");
prefixTree.AddWord("abc132d");
string word = "abc";
if (prefixTree.Find(word))
{
var matches = prefixTree.GetMatches("abc");
Console.WriteLine("gasit");
Console.WriteLine("Autocomplete:");
if (matches.Count > 0)
foreach (var m in matches)
Console.WriteLine(m);
}
else
Console.WriteLine("nu gasii nimic");
}
}
}