سلام اخواني انهيت مشروع طبعا بلغة الخوارزميات وتبقي لدي تحويله الي لغة السي التي اجهلها وحيث انني من اصل فلسطيني ومن سوء حظي ان مدرستي يهودية فرنسيه عدينا الامتحان النظري وتبقي علي ان احول ما انهيت لمشروعي الي لغة السي يا ريت تساعدوني
المشروع يتعلق بProject ternary search trees
تركيبة المشروع A node of an ATR has three son, the left FG, the right FD, and the middle FM. The'etiquette
node is a character. Every node of an ATR is repr'esent'e by the following structure
typedef struct tnode *Tptr;
typedef struct tnode {
char etiq;
Tptr FG, FM, FD;
} Tnode;
ودالة البحث
It is assumed here that the strings of characters ending with the character '\ 0', as in C.
The character '\ 0' is smaller than all the other characters. In what follows, first (s)
denote the first character of s, and following (s) the word priv'e its first character.
To search for a word s in the tree, looking at the first character of s. If more
smaller than the root, it `s research has left, if greater, one seeks` s right, and
it is' equal, we descend into the middle son, and we will search after the word s.
والدالة تكون كالتالي
Search (p, s)
beginning
if p = NULL Then Return (0);
if first (s) <p-> etiq then Return (Search (p-> FG, s));
if first (s)> p-> etiq then Return (Search (p-> fd, s));
if first (s) = '\ 0' then Return (1)
Return if (Search (p-> FM sequence (s))
لادخال كلمة جديدة علينا ان نستخدم هده الدالة
function Insert (p, s)
beginning
if p = null then
(P: = (Tpr) malloc (sizeof (tNode));
p-> etiq: = first (s);
p-> FG: = NULL;
p-> FM: = NULL;
p-> FD: = NULL
if first (s) <p-> etiq then p-> FG: = Insert (p-> FG, s);
if first (s)> p-> etiq then p-> FD: = Insert (p-> fd, s);
if first (s) = p-> etiq then
(if first (s)! = '\ 0' then p-> FM: = Insert (p-> FM sequence (s)))
null
You can browse the tree to get a `way the words in lexicographic order.
Traverse function (p, w, i)
beginning
if p = null then return ();
Traverse (p-> FG, w, i);
w : = p -> etiq;
if p-> etiq! = '\ 0' then Traverse (p-> FM, w, i +1)
Show if (w);
Traverse (p-> FD, w, i);
end
The appeal is with the following function.
function Distance (p)
beginning
Traverse (p, word, 0)
end
Creation of the tree
N The words are stock'es in a file on disk. Each word uses a line. For
obtain an ATR that is as' equilibr'e as possible, the program begins by reading the
file and store the words in ascending order in Table A. To construct the tree
we begin by ins'erer the'el'ement the middle, then the r'ecursivement 'el'ements smaller
the 'greatest el'ements.
Insertion_tous function (A, n)
beginning
if n <1 then Return ();
m: = n div 2;
root: = Insert (root, A [m]);
Insertion_tous (A, m);
Insertion_tous (A + m +1, n-m-1)
end
The appeal is with the following function.
Service Creation (A, n)
beginning
root: = NULL;
Insertion_tous (A, n)
end
Search type Search crois'es "
It is a word search with wildcards, one joker SINCE not'e.. For example, if the
dictionary contains the words "low" and "doing" the research. "a." give "low" and "doing".
The structure of the function that performs this search is similar to the function Traverse.
Rech_mc function (p, s, w, i)
beginning
if p = null then return ();
if first (s) = "." or first (s) <p-> etiq then Rech_mc (p-> FG, s, w, i);
w : = p -> etiq;
if first (s) = "." or first (s) = p-> etiq then
if p-> etiq! = '\ 0' and first (s)! = '\ 0' then Rech_mc (p-> FM sequence (s), w, i +1);
if first (s) = '\ 0' and p-> etiq = '\ 0' then show (w);
if first (s) = "." or first (s)> p-> etiq then Rech_mc (p-> fd, s, w, i)
end...
المطلوب هو Using the structure of ATR to implement a dictionary fran ¸ cais op'erations with which
have 'et'e writings.
2. Optional 'write a function that deletes a word from the dictionary.
3. Building a lexicon French - English and use it.
بارك الله بيكم