aboutsummaryrefslogtreecommitdiff
path: root/README.org
diff options
context:
space:
mode:
Diffstat (limited to 'README.org')
-rw-r--r--README.org152
1 files changed, 152 insertions, 0 deletions
diff --git a/README.org b/README.org
new file mode 100644
index 0000000..64b46ec
--- /dev/null
+++ b/README.org
@@ -0,0 +1,152 @@
1#+title: Implementation of a dictionary based on hash tables and red‑black trees
2
3* Task[fn:1]
41. Implement a data structure -- a hash table, which is characterized
5 by the following operations: insertion, deletion, and search.
6 Based on it, implement an application -- a dictionary. As a hash
7 function, you can choose an arbitrary function, for example, taking
8 the first letter of the word. Add The function for completely
9 clearing the dictionary and loading/updating the dictionary from a
10 text file.
112. For the selected text in Russian, build a dictionary based on
12 red‑black trees. Implement functions for adding, deleting, and
13 searching for a word. (use of ready‑made data structures is
14 PROHIBITED!!!). Add a function for completely clearing the
15 dictionary and loading/updating the dictionary from a text file.
16
17The additional implementation also includes the possibility of
18optimizing the dictionary (for example, searching for potential
19cognates in different forms; the simplest criterion is 2/3 of the word
20length). The choice of words to be kept in the dictionary is up to the
21user. It is not allowed to use ready‑made solutions from the STL
22library.
23
24* Documentation
25The exported report can be found at [[https://git.michalec.dev/uni/term-04/graph-theory/lab-06/report.pdf][this link]].
26
27* Showcase
28*Start of the program and the menu:*
29#+begin_example
30HASH-TABLE:......FILE LOADED (159 ENTRIES)
31RED-BLACK-TREE:..FILE LOADED (159 ENTRIES)
32
33SELECT:
34 [00] GENERAL:.........EXIT
35 [01] HASH-TABLE:......PRINT
36 [02] HASH-TABLE:......INSERT
37 [03] HASH-TABLE:......DELETE
38 [04] HASH-TABLE:......SEARCH
39 [05] HASH-TABLE:......CLEAR
40 [06] HASH-TABLE:......LOAD_FROM_FILE
41 [07] RED-BLACK-TREE:..PRINT
42 [08] RED-BLACK-TREE:..INSERT
43 [09] RED-BLACK-TREE:..DELETE
44 [10] RED-BLACK-TREE:..SEARCH
45 [11] RED-BLACK-TREE:..CLEAR
46 [12] RED-BLACK-TREE:..LOAD_FROM_FILE
47>
48#+end_example
49
50*Example output of the PRINT menu items*:
51#+attr_html: :width 400em
52[[https://git.michalec.dev/uni/term-04/graph-theory/lab-06/example-hash-table.png]]
53
54#+attr_html: :width 400em
55[[https://git.michalec.dev/uni/term-04/graph-theory/lab-06/example-red-black-tree.png]]
56
57*Example session:* (menu replaced with # comments)
58 #+begin_src text
59> asdf
60> -1
61> 13
62>
63> 04 # (HASH-TABLE) SEARCH
64WORD: словарь
65ENTRY FOUND
66> 10 # (RED-BLACK-TREE) SEARCH
67WORD: словарь
68ENTRY FOUND
69>
70> 04 # (HASH-TABLE) SEARCH
71WORD: тест
72ENTRY NOT FOUND
73> 10 # (RED-BLACK-TREE) SEARCH
74WORD: тест
75ENTRY NOT FOUND
76> 06 # (HASH-TABLE) LOAD_FROM_FILE
77FILENAME: text
78FILE LOADED (30 ENTRIES)
79> 12 # (RED-BLACK-TREE) LOAD_FROM_FILE
80FILENAME: text
81FILE LOADED (30 ENTRIES)
82> 04 # (HASH-TABLE) SEARCH
83WORD: тест
84ENTRY FOUND
85> 10 # (RED-BLACK-TREE) SEARCH
86WORD: тест
87ENTRY FOUND
88>
89> 02 # (HASH-TABLE) INSERT
90WORD: слово
91ENTRY INSERTED
92> 04 # (HASH-TABLE) SEARCH
93WORD: слово
94ENTRY FOUND
95> 03 # (HASH-TABLE) DELETE
96WORD: слово
97ENTRY DELETED
98> 04 # (HASH-TABLE) SEARCH
99WORD: слово
100ENTRY NOT FOUND
101> 05 # (HASH-TABLE) CLEAR
102HASH TABLE CLEARED
103> 04 # (HASH-TABLE) SEARCH
104WORD: тест
105ENTRY NOT FOUND
106>
107> 08 # (RED-BLACK-TREE) INSERT
108WORD: слово
109ENTRY INSERTED
110> 10 # (RED-BLACK-TREE) SEARCH
111WORD: слово
112ENTRY FOUND
113> 09 # (RED-BLACK-TREE) DELETE
114WORD: слово
115ENTRY DELETED
116> 10 # (RED-BLACK-TREE) SEARCH
117WORD: слово
118ENTRY NOT FOUND
119> 11 # (RED-BLACK-TREE) CLEAR
120HASH TABLE CLEARED
121> 10 # (RED-BLACK-TREE) SEARCH
122WORD: тест
123ENTRY NOT FOUND
124> 00 # (GENERAL) EXIT
125#+end_src
126
127* Unlicense
128#+include: UNLICENSE verse
129
130* Footnotes
131[fn:1] Original text:
132#+HTML: <i>
133#+begin_quote
1341. Реализовать структуру данных -- хеш-таблицу, для которой характерны
135 операции: добавления, удаления и поиска. На ее основе реализовать
136 приложение -- словарь. В качестве хеш-функции, можно выбрать
137 произвольную функцию, например, брать первую букву слова. Добавить
138 функцию полной очистки словаря и загрузки/дополнения словаря из
139 текстового файла.
1402. Для выбранного текста на русском языке построить словарь на основе
141 красно-черных деревьев. Реализовать функции добавления, удаления и
142 поиска слова. (НЕЛЬЗЯ использовать готовые структуры данных!!!).
143 Добавить функцию полной очистки словаря и загрузки/дополнения
144 словаря из текстового файла.
145
146Дополнительная реализация также включает возможность оптимизации
147словаря (например, поиск потенциальных однокоренных слов в разных
148формах; самый простой критерий -- 2/3 длины слова). Выбор слов,
149которые следует оставить в словаре -- за пользователем. Использовать
150готовые решения из библиотеки STL не разрешается.
151#+end_quote
152#+HTML: </i>