+ 2

Creat dictionnary with c language .

Hello everyone i'm actually a simple beginner in programming and i have a project to hand out next month . I really don't know from where to start could anyone help me !

20th Dec 2019, 4:41 PM
Sara Min
Sara Min - avatar
15 odpowiedzi
+ 5
Not an easy beginner task in C. You can implement a mini version with an array of struct.
20th Dec 2019, 11:32 PM
John Wells
John Wells - avatar
+ 4
Alphabetic characters are still numbers in C. The string.h function of strcmp can compare two character arrays regardless of their contents.
21st Dec 2019, 1:25 PM
John Wells
John Wells - avatar
+ 4
Good luck. Any more questions you can ask here. I liked the idea so I coded something likely more complex than you need. Let me see your finished product and I will show you mine.
21st Dec 2019, 1:49 PM
John Wells
John Wells - avatar
+ 3
Thank you very much sir !! Have a good day :)
21st Dec 2019, 1:36 PM
Sara Min
Sara Min - avatar
+ 3
I will make sure to do so . Thanks again ^^
21st Dec 2019, 3:21 PM
Sara Min
Sara Min - avatar
+ 3
I think u have a 3 solutions: 1) array of structs which contains key and value field. and u need to implement search, apply, append and other functions of dictionary 2) u must implement hash function, construct array with fix size (2^8, 2^16, etc.), where id of element is a hash of key. this is a fast method of access to value by key. 3) implement red-black-tree concept. for key type must be implement a less operator.
21st Dec 2019, 10:27 PM
Myasnikov Aleksey
Myasnikov Aleksey - avatar
+ 2
Thanks alot ! One more question sir !! It actually tells us to create a function to search for the word existance using dichotomy :3 how do i use dichotomy with aphabets ?? (I mean the test)
21st Dec 2019, 7:18 AM
Sara Min
Sara Min - avatar
+ 2
welcome)
23rd Dec 2019, 10:49 PM
Myasnikov Aleksey
Myasnikov Aleksey - avatar
22nd Dec 2019, 7:57 PM
Myasnikov Aleksey
Myasnikov Aleksey - avatar
+ 1
Thanks alot Myasnikov Aleksey you helped me alot ^^ . I will be sharing my work when i finish it ☺️
22nd Dec 2019, 8:22 PM
Sara Min
Sara Min - avatar
0
I was thinking the same as your first suggestion of solutions. Using arrays of struct . I still havennt reached the concept of trees so~ :) you helped me alot god bless all of you ^√^
22nd Dec 2019, 7:17 AM
Sara Min
Sara Min - avatar
0
The first solution have very long access time. classic map must have constant access time
22nd Dec 2019, 9:54 AM
Myasnikov Aleksey
Myasnikov Aleksey - avatar
0
Which type of keys u need? For simple types hash functions are already known. What approximately size of dictionary must be?
22nd Dec 2019, 10:01 AM
Myasnikov Aleksey
Myasnikov Aleksey - avatar
0
Myasnikov Aleksey well in general the professor told us to create dictionnary using (tableaux de hachage ) which is hash arrays ! But we have to create our own string library and file library (so we can read the file the professor sent us) i started implementing some functions like search function compression function collision function a function to fill the array ... Ect
22nd Dec 2019, 3:07 PM
Sara Min
Sara Min - avatar
0
Sorry i'm not sure if it's called hash arrays in english 😅 i tried to translate that's what i got
22nd Dec 2019, 3:08 PM
Sara Min
Sara Min - avatar