diff --git a/lab25/lab25/sort test.xlsx b/lab25/lab25/sort test.xlsx index 9eb8895..b8180b6 100644 Binary files a/lab25/lab25/sort test.xlsx and b/lab25/lab25/sort test.xlsx differ diff --git a/lab26/TextProcessingDict/Dict.h b/lab26/TextProcessingDict/Dict.h index 343ef33..e18fe52 100644 --- a/lab26/TextProcessingDict/Dict.h +++ b/lab26/TextProcessingDict/Dict.h @@ -1,6 +1,6 @@ #pragma once -#define DICT_ARRAY_C +#define DICT_TREE_C /* : diff --git a/lab26/TextProcessingDict/DictHash.c b/lab26/TextProcessingDict/DictHash.c index 23600ad..2588618 100644 --- a/lab26/TextProcessingDict/DictHash.c +++ b/lab26/TextProcessingDict/DictHash.c @@ -1,21 +1,26 @@ // // // - -#ifdef DICT_HASH_C - #define _CRT_SECURE_NO_WARNINGS #include #include #include "Dict.h" +#include "fnvhash_32a.h" +#include "jhash.h" -#define MAX_HASH 13267 +#ifdef DICT_HASH_C struct Node { char* word; struct Node* next; }; +#define FNV_HASH + +#if defined VLASENKO_HASH + +#define MAX_HASH 13267 + // struct Node* first[MAX_HASH]; @@ -30,6 +35,31 @@ int hash(char* word) { return hash_value % MAX_HASH; } +#elif defined JHASH + +#define MAX_HASH 16384 + +// +struct Node* first[MAX_HASH]; + +int hash(char* word) { + int hash_value = (int)jhash(word, strlen(word) + 1, FNV1_32A_INIT); + hash_value = hash_value & hashmask(14); +} + +#elif defined FNV_HASH +#define MAX_HASH 16384 + +// +struct Node* first[MAX_HASH]; + +int hash(char* word) { + int hash_value = (int)fnv_32a_str(word, FNV1_32A_INIT); + hash_value = TINY_FNV(14, hash_value); +} + +#endif + /* INSERT . . , . diff --git a/lab26/TextProcessingDict/DictLinkedList.c b/lab26/TextProcessingDict/DictLinkedList.c index b2f70d4..e07e14d 100644 --- a/lab26/TextProcessingDict/DictLinkedList.c +++ b/lab26/TextProcessingDict/DictLinkedList.c @@ -1,5 +1,3 @@ -#ifdef DICT_LINKED_LIST_C - // // // @@ -9,6 +7,7 @@ #include "Dict.h" +#ifdef DICT_LINKED_LIST_C // struct Node { diff --git a/lab26/TextProcessingDict/DictSortedArray.c b/lab26/TextProcessingDict/DictSortedArray.c index 1df2fa9..df4bb38 100644 --- a/lab26/TextProcessingDict/DictSortedArray.c +++ b/lab26/TextProcessingDict/DictSortedArray.c @@ -1,9 +1,10 @@ -#ifdef DICT_SORTED_ARRAY_C - #define _CRT_SECURE_NO_WARNINGS #include +#include #include "Dict.h" +#ifdef DICT_SORTED_ARRAY_C + #define MAX_WORDS 10000 // @@ -48,6 +49,15 @@ MEMBER */ int Member(char* word) { // + + if (bsearch(word, words, numWords, sizeof(char), strcmp)) { + return 1; + } + else { + return 0; + } + + /* int left = 0; int right = numWords - 1; @@ -65,7 +75,7 @@ int Member(char* word) { right = middle - 1; } } - return 0; + return 0;*/ } #endif diff --git a/lab26/TextProcessingDict/DictTree.c b/lab26/TextProcessingDict/DictTree.c index bec342a..38185b1 100644 --- a/lab26/TextProcessingDict/DictTree.c +++ b/lab26/TextProcessingDict/DictTree.c @@ -2,13 +2,13 @@ // // -#ifdef DICT_TREE_C - #define _CRT_SECURE_NO_WARNINGS #include #include #include "Dict.h" +#ifdef DICT_TREE_C + // struct NodeTree { char* word; diff --git a/lab26/TextProcessingDict/TextProcessing.c b/lab26/TextProcessingDict/TextProcessing.c index 98316d7..10e3757 100644 --- a/lab26/TextProcessingDict/TextProcessing.c +++ b/lab26/TextProcessingDict/TextProcessing.c @@ -119,7 +119,7 @@ int TextProcessing(char* filenameIn, char* filenameOut) { fprintf(fout, ""); fprintf(fout, ""); fprintf(fout, ""); - fprintf(fout, ""); + fprintf(fout, ""); fprintf(fout, "HTML Document"); fprintf(fout, ""); fprintf(fout, ""); diff --git a/lab26/TextProcessingDict/TextProcessingDict.vcxproj b/lab26/TextProcessingDict/TextProcessingDict.vcxproj index 668cb34..ea856e1 100644 --- a/lab26/TextProcessingDict/TextProcessingDict.vcxproj +++ b/lab26/TextProcessingDict/TextProcessingDict.vcxproj @@ -104,10 +104,12 @@ true _DEBUG;_CONSOLE;%(PreprocessorDefinitions) true + ..\..\hash functions Console true + 4194304 @@ -127,6 +129,8 @@ + + @@ -135,6 +139,8 @@ + + diff --git a/lab26/TextProcessingDict/TextProcessingDict.vcxproj.filters b/lab26/TextProcessingDict/TextProcessingDict.vcxproj.filters index 9463f85..c245e21 100644 --- a/lab26/TextProcessingDict/TextProcessingDict.vcxproj.filters +++ b/lab26/TextProcessingDict/TextProcessingDict.vcxproj.filters @@ -33,10 +33,22 @@ Исходные файлы + + Исходные файлы + + + Исходные файлы + Файлы заголовков + + Файлы заголовков + + + Файлы заголовков + \ No newline at end of file diff --git a/lab26/TextProcessingDict/out/Alice_out.html b/lab26/TextProcessingDict/out/Alice_out.html index b37dfc6..f8abb40 100644 --- a/lab26/TextProcessingDict/out/Alice_out.html +++ b/lab26/TextProcessingDict/out/Alice_out.html @@ -1,4 +1,4 @@ -HTML DocumentAlice's Adventures in Wonderland
+HTML DocumentAlice's Adventures in Wonderland
Lewis Carroll


diff --git a/lab26/TextProcessingDict/out/Tolkien2_out.html b/lab26/TextProcessingDict/out/Tolkien2_out.html index 7411698..39cfbcc 100644 --- a/lab26/TextProcessingDict/out/Tolkien2_out.html +++ b/lab26/TextProcessingDict/out/Tolkien2_out.html @@ -1,4 +1,4 @@ -HTML DocumentThe Fellowship of the Ring
+HTML DocumentThe Fellowship of the Ring
J. R. R. Tolkien


diff --git a/lab26/TextProcessingDict/out/Tolkien_out.html b/lab26/TextProcessingDict/out/Tolkien_out.html index cf3fa98..1eb9e57 100644 --- a/lab26/TextProcessingDict/out/Tolkien_out.html +++ b/lab26/TextProcessingDict/out/Tolkien_out.html @@ -1,4 +1,4 @@ -HTML DocumentThe Fellowship of the Ring
+HTML DocumentThe Fellowship of the Ring
J. R. R. Tolkien


diff --git a/lab26/ФИСТ2024_ЛР26_Время_работы_разных_реализаций_Словаря.xlsx b/lab26/ФИСТ2024_ЛР26_Время_работы_разных_реализаций_Словаря.xlsx index 8a1c6d4..ae1a3b9 100644 Binary files a/lab26/ФИСТ2024_ЛР26_Время_работы_разных_реализаций_Словаря.xlsx and b/lab26/ФИСТ2024_ЛР26_Время_работы_разных_реализаций_Словаря.xlsx differ