private void add_word(string word, hashtab head) { for (int i = 0; i < word.Length; i++) { if (alpha.Keys.Contains(word[i])) { if (head.point.Count == 0) { for (int x = 0; x < globals.total_count; x++) { hashtab h1 = new hashtab(); head.point.Add(h1); } } head.cont[alpha[word[i]]] = 1; if (i == word.Length - 1) { head.ext[alpha[word[i]]] = 1; } head = head.point[alpha[word[i]]]; } else { MessageBox.Show(word); } } }
private void check_word(string word, hashtab head) { richTextBox1.Clear(); for (int i = 0; i < word.Length; i++) { if (alpha.Keys.Contains(word[i])) { if (head.ext[alpha[word[i]]] == 1) { richTextBox1.Text = "exists"; } else { richTextBox1.Text = "not exists"; } if (head.cont[alpha[word[i]]] == 1) { head = head.point[alpha[word[i]]]; } if (i == word.Length - 1) { richTextBox2.Clear(); complete_word(word, head); } } } }
private void complete_word(string word, hashtab head) { for (int i = 0; i < globals.total_count; i++) { if (head.ext[i] == 1) { string word2 = word; word2 += num[i].ToString(); richTextBox2.Text += word2 + "\n"; } if (head.cont[i] == 1) { string word2 = word; word2 += num[i].ToString(); hashtab head2 = head.point[i]; complete_word(word2, head2); } } }